472,141 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,141 software developers and data experts.

ImportError: No module named getopt

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?

Nov 23 '06 #1
4 9223
"prashant" wrote:
>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>

Nov 23 '06 #2
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?
Fredrik Lundh wrote:
"prashant" wrote:
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>
Nov 23 '06 #3
"prashant" wrote:
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>

Nov 23 '06 #4
thanks a lot that helped...
Fredrik Lundh wrote:
"prashant" wrote:
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>
Nov 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Carsten Gehling | last post: by
reply views Thread by Wicked | last post: by
reply views Thread by M. Lavasani | last post: by
reply views Thread by Robert Dailey | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.