ImportError: No module named getopt

P

prashant

I am running a python script which has the line

import getopt, sys, os, re, string

And i get the error

ImportError: No module named getopt

Could you please point out a possible solution for this?
 
F

Fredrik Lundh

prashant said:
I am running a python script which has the line

import getopt, sys, os, re, string

And i get the error

ImportError: No module named getopt

Could you please point out a possible solution for this?

looks like a broken installation. try running the script as

python -vv script.py

and see where it looks for the getopt module.

is the ImportError all you get, btw ? it doesn't complain about site.py before
that ?

</F>
 
P

prashant

Thanks for the reply,
I am actually using Cygwin to run a python script.
I have python 2.5 installed. But when i ran the command mentioned by
you... I see that it is looking in the wrong directories... how can i
change these look up directories?
 
F

Fredrik Lundh

prashant said:
I am actually using Cygwin to run a python script.
I have python 2.5 installed. But when i ran the command mentioned by
you... I see that it is looking in the wrong directories... how can i
change these look up directories?

is PYTHONHOME perhaps set to the wrong thing?

if not, you can point it to the root of your Python installation. use "python -h"
for more alternatives.

</F>
 
P

prashant

thanks a lot that helped...


Fredrik said:
is PYTHONHOME perhaps set to the wrong thing?

if not, you can point it to the root of your Python installation. use "python -h"
for more alternatives.

</F>
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top