473,468 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 9550
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Carsten Gehling | last post by:
Figured out myself - I just removed the line with "from url import Url" -it doesn't seem to be used anywhere ;-) - Carsten > -----Oprindelig meddelelse----- > Fra:...
2
by: x-herbert | last post by:
Hi, I have a small test to "compile" al litle script as a WMI-Tester. The script include a wmi-wrapper and "insert" the Win32-modeles. here the code: my "WMI-Tester.py" ----- import wmi
0
by: Wicked | last post by:
Hi all, Has anyone got rpm.py? Is this a class/module for Python? I am getting the following error: File "./extra/scripts/update_release.py", line 42, in ? import rpm ImportError: No...
0
by: M. Lavasani | last post by:
Hi I am trying to test Python-2.3. Any solution for this problem please: >>>gmake test case $MAKEFLAGS in \ *-s*)...
0
by: Robert Dailey | last post by:
I created a basic python file and made an attempt to execute it from the command line, however it gives me a weird error after the python file has been executed: Traceback (most recent call...
1
by: Prof Rodney Coates | last post by:
Although I have been using Macs for a quarter of a century and was doing scientific programming in the '60's I am VERY new to Python on the Mac. I have been writing some very simple applications and...
0
by: Barak, Ron | last post by:
Hi, I'm trying to compile using py2exe, and am getting the following: $ python_win Setup.py py2exe running py2exe creating c:\Documents and Settings\rbarak\rbarak_devel\dpm09\build creating...
4
by: Daniel | last post by:
Hello, I'm trying to build a very simple IPC system. What I have done is create Data Transfer Objects (DTO) for each item I'd like to send across the wire. I am serializing these using...
1
by: manasonnet | last post by:
ava.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.