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

NameError: global name 'csv' is not defined #1

Open
rokayattila opened this issue Apr 8, 2016 · 5 comments
Open

NameError: global name 'csv' is not defined #1

rokayattila opened this issue Apr 8, 2016 · 5 comments

Comments

@rokayattila
Copy link

When I run the script I get the following error message: NameError: global name 'csv' is not defined

Do you have any idea?

@ekta1007
Copy link
Owner

ekta1007 commented Apr 8, 2016

import csv :)

On Fri, Apr 8, 2016 at 9:56 PM, rokayattila [email protected]
wrote:

When I run the script I get the following error message: NameError: global
name 'csv' is not defined

Do you have any idea?


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#1

Stay Tall,
Ekta
http://www.linkedin.com/in/ektagrover

@rokayattila
Copy link
Author

Ok is missed that...
my only problem that remains is the layout of the csv:
kepernyofoto 2016-04-08 - 19 20 53
Do you have any idea how to order it?

@ekta1007
Copy link
Owner

ekta1007 commented Apr 8, 2016

Please separator issue, of course .

@rokayattila
Copy link
Author

Ok I am newbie, so i don't get you. I had just a small modification in your code:

mywriter = csv.writer(open("ebaytest.csv", "wb")) head = ("name", "price2") mywriter.writerow(head) for i in range(0,len(price2)): mywriter.writerow([name[i],price2[i]]) print ' My first baby scraping was a success!! '

@ekta1007
Copy link
Owner

ekta1007 commented Apr 8, 2016

Obviously the xpaths have changed on ebay since I wrote that code 3 years
ago & that's why you are getting this . Aside of that fix the separator ,
see also :
http://stackoverflow.com/questions/14693646/writing-to-csv-with-python-adds-blank-lines
Plainly running the code if you are newbie without understanding what's it
doing won't teach you - dig into a handful of the lines from code and run a
simple hello world on each usage.

Happy learning !

On Fri, Apr 8, 2016 at 11:15 PM, rokayattila [email protected]
wrote:

Ok I am newbie, so i don't get you. I had just a small modification in
your code:

mywriter = csv.writer(open("ebaytest.csv", "wb"))
head = ("name", "price2")
mywriter.writerow(head)
for i in range(0,len(price2)):
mywriter.writerow([name[i],price2[i]])
print ' My first baby scraping was a success!! '


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#1 (comment)

Stay Tall,
Ekta
http://www.linkedin.com/in/ektagrover

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

2 participants