Path difficulties with Python 2.5 running on Cygwin

W

walterbyrd

It workerd fine yesterday, but it won't work today.

I can still run python, but when I try to import csv, I get an error:

File "/usr/lib/python2.5/csv.py", line 8 in <module> . . .

The module is there. I am guessing that python can not find it.
 
W

walterbyrd

It workerd fine yesterday, but it won't work today.

I can still run python, but when I try to import csv, I get an error:

File "/usr/lib/python2.5/csv.py", line 8 in <module>  . . .

The module is there. I am guessing that python can not find it.

I should have added:

When I am in /cygdrive/c/Documents and Settings, everything works
fine. But, when I am in /cygdrive/c/Documents and Settings/wbyrd, it
no longer works.

I also get the error: Attribute error: module has no attribute
'reader'

I accidently named a script csv.py, put I deleted that. It seems like
I might need to clear out the python interprator, but I don't know how
to do that.
 
J

Jerry Hill

I accidently named a script csv.py, put I deleted that.

You probably still have a stale csv.pyc in that directory. Delete that too.

To tell for sure, open the python interpreter and do:
import csv
print csv.__file__

That will tell you exactly where the csv module is being loaded from.
 
W

walterbyrd

You probably still have a stale csv.pyc in that directory.  Delete that too.

I don't, I am very certain of that. I have also used find to make
certain there are no other stray versions of csv.py.
To tell for sure, open the python interpreter and do:
import csv
print csv.__file__

That will tell you exactly where the csv module is being loaded from.

Problem is, python will not load the csv module, since it detects an
error. And since I can not load the module, csv.__file__ will not
work.


This file will work:
-----------------
#!/usr/bin/env python

# import csv

print "hello"
------------------


This file will not work:
-----------------
#!/usr/bin/env python

import csv

print "hello"
 
W

walterbyrd

Okay, I got it. I was looking for csv.py - because that is what I
accidently created. I don't know where csv.pyc came from, unless
python renamed it that when it tried to load csv.py, or something.

In any case, it seems to work now. Thanks again for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top