954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Opening CSV File Using Reader

This is a continuation of problems with the program posted here: http://www.daniweb.com/software-development/python/threads/372311

I started thinking there was something wrong with my statement to open the csv file, using the reader.

reader = csv.reader(open('C:/Documents and Settings/VPC.VPC-SCALA.000/Desktop/RAH 7-11-11/RH/Projected Cash Goals Template.csv', 'rb'))

I put a test statement above the open statement and the test worked the way it was supposed to but when I move it below the open statement, it no longer works. Then, I ran

if os.path.exists('C:/Documents and Settings/VPC.VPC-SCALA.000/Desktop/RAH 7-11-11/RH/Projected Cash Goals Template.csv'):
    print 100
else:
    print 2

and got the else branch. I don't see why it would be telling me that this file path does not exist since I can look in the folder and clearly see that it does. I get no errors when running

Python get_csv_data.py

in windows cmd and I can open the csv file just fine in a Python command line and then get it to do everything I need it to do...I'm running out of ideas and options of things to try.

rhuffman8
Light Poster
30 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

fixed it...sorry, the error wasn't in the Python code, it was in the program I was running the Python code with.

rhuffman8
Light Poster
30 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: