Right place for third party modules (here: fixedpoint)

S

Sibylle Koczian

Hello,

for the first time since getting Python I can't get a third party module
to work.

I got fixedpoint.0.1.2.tar.gz from SourceForge for use with KinterbasDB.
After unpacking I had a directory called "fixedpoint" which I put under
my site-packages directory. There are no installation instructions and
just the one module fixedpoint.py (and some documentation and examples).

All of this under Windows XP, with Python 2.4.

Now I try to use the module, but

import fixedpoint

says "ImportError: No module named fixedpoint".

I suppose fixedpoint is no package as described in the tutorial and so
"site-packages" might not be the right place for it. But where does it
belong? I think it should go somewhere in the Python directory tree, not
among my own scripts.

Thank you,
Koczian

--
Dr. Sibylle Koczian
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg

Tel.: (0821) 598-2400, Fax : (0821) 598-2410
e-mail : (e-mail address removed)-Augsburg.DE
 
S

Steve Holden

Sibylle said:
Hello,

for the first time since getting Python I can't get a third party module
to work.

I got fixedpoint.0.1.2.tar.gz from SourceForge for use with KinterbasDB.
After unpacking I had a directory called "fixedpoint" which I put under
my site-packages directory. There are no installation instructions and
just the one module fixedpoint.py (and some documentation and examples).

All of this under Windows XP, with Python 2.4.

Now I try to use the module, but

import fixedpoint

says "ImportError: No module named fixedpoint".

I suppose fixedpoint is no package as described in the tutorial and so
"site-packages" might not be the right place for it. But where does it
belong? I think it should go somewhere in the Python directory tree, not
among my own scripts.

Thank you,
Koczian
Instead, just move the "fixedpoint.py" file to your site-packages
directory. You can then delete the empty fixedpoint directory, as it
won't do anything except get in the way.

Packages are implemented as directories, but modules are single Python
files. "Site-packages" is a perfectly acceptable place to put "site
modules" as well ;-)

regards
Steve
 
F

Fredrik Lundh

Sibylle said:
for the first time since getting Python I can't get a third party module to work.

I got fixedpoint.0.1.2.tar.gz from SourceForge for use with KinterbasDB. After unpacking I had a
directory called "fixedpoint" which I put under my site-packages directory. There are no
installation instructions and just the one module fixedpoint.py (and some documentation and
examples).

All of this under Windows XP, with Python 2.4.

Now I try to use the module, but

import fixedpoint

says "ImportError: No module named fixedpoint".

I suppose fixedpoint is no package as described in the tutorial and so "site-packages" might not
be the right place for it.

site-packages sure works on my windows xp / python 2.4 configuration.

what is your sys.path set to?
['', 'C:\\WINDOWS\\system32\\python24.zip', ... 'C:\\python24',
'C:\\python24\\lib\\site-packages', ... ]

if you fire up a command window and run

python -v -v -c "import fixedpoint"

you get a list of places where python looks for that module. does it look
in right directory?

(this can be very verbose; you might wish to do

python -v -v -c "import fixedpoint" 2> out
notepad out

instead)

</F>
 
F

Fredrik Lundh

I suppose fixedpoint is no package as described in the tutorial and so "site-packages" might not
site-packages sure works on my windows xp / python 2.4 configuration.

ah, forget what I said. you need to put the fixedpoint.py *file* under site-packages,
not the entire directory. as that "python -v -v" would have told you:
....
# trying C:\python24\lib\site-packages\fixedpoint.pyd
# trying C:\python24\lib\site-packages\fixedpoint.dll
# trying C:\python24\lib\site-packages\fixedpoint.py
# trying C:\python24\lib\site-packages\fixedpoint.pyw
# trying C:\python24\lib\site-packages\fixedpoint.pyc
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: No module named fixedpoint
....

</F>
 
S

Sibylle Koczian

Fredrik said:
ah, forget what I said. you need to put the fixedpoint.py *file* under site-packages,
not the entire directory. as that "python -v -v" would have told you:
Thank you (and Steve Holden), that did it.
...
# trying C:\python24\lib\site-packages\fixedpoint.pyd
# trying C:\python24\lib\site-packages\fixedpoint.dll
# trying C:\python24\lib\site-packages\fixedpoint.py
# trying C:\python24\lib\site-packages\fixedpoint.pyw
# trying C:\python24\lib\site-packages\fixedpoint.pyc
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: No module named fixedpoint
...

</F>

Very helpful, not only directories, but full module names. I hope I'll
remember (or find) "python -v -v" next time around.

Python is nice, but Python + c.l.p. is a Really Good Thing.

Koczian

--
Dr. Sibylle Koczian
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg

Tel.: (0821) 598-2400, Fax : (0821) 598-2410
e-mail : (e-mail address removed)-Augsburg.DE
 

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

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top