Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hello thanks for the code #1

Open
MightyTedKim opened this issue Sep 17, 2018 · 1 comment
Open

hello thanks for the code #1

MightyTedKim opened this issue Sep 17, 2018 · 1 comment

Comments

@MightyTedKim
Copy link

hello thanks for the code
I'vce put some prints in the code to check where i am
and think writer.writeheader() part is the problem.
can give me a tip how to go through this propblem?

thanks

start
main.py name: main
retrieving stores
retry: 0
processing store details
Writing scraped data to 20005_stores.csv
writer: <csv.DictWriter object at 0x000001CCC3B55B70>
Traceback (most recent call last):
File "walmart_store_locator.py", line 77, in
writer.writeheader()
File "C:\ProgramData\Anaconda3\lib\csv.py", line 144, in writeheader
self.writerow(header)
File "C:\ProgramData\Anaconda3\lib\csv.py", line 155, in writerow
return self.writer.writerow(self._dict_to_list(rowdict))
TypeError: a bytes-like object is required, not 'str'

@MightyTedKim
Copy link
Author

MightyTedKim commented Sep 17, 2018

ah sorry I stackoverflowed

changing wb to w
with open('%s_stores.csv' % (zip_code), 'w') as csvfile:

was using python 3

https://stackoverflow.com/questions/34283178/typeerror-a-bytes-like-object-is-required-not-str-in-python-and-csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant