squeeze and package imports

Mathias Waack M.Waack at gmx.de
Thu Sep 25 17:00:37 CEST 2003


I've got a problem with Fredrik's squeeze tool. I've got a script
which accesses a Oracle DB with the help of DCOracle. This script
works very well, but after squeezing it the "import DCOracle" fails.
The DCOracle package consists of several python files and some
shared libs. The import of one shared lib from within the package
fails. It looks like a problem with the code responsible for
searching the appropriate module file. 

Let me try to illustrate the situation. DCOracle ist installed under
/tmp for example:

  +--- DCOracle
           +----- odb.py
           +----- Buffer.sl
           +----- __init__.py

__init__.py imports odb.py which imports Buffer.sl, that means in
odb.py you can find statements like
        from Buffer import Buffer

If I import it from my script:

        import DCOracle

it works without squeezing and fails with squeezing. In the latter
case, the Buffer import statement named above fails. The traceback
shows, which import in which file is executed, but instead of the
directory names of each file it prints only question marks "?". Thus
I thought, if the import code doesn't know about the current
directory, it can't import the Buffer module, because it can't look
into the "same" directory. And so my second try:

        import DCOracle

And everything works fine. But I'm still curious - there seems to be
something wrong with the import hooks in the squeeze module. BTW,
I'm using python 2.2.2. 

Any ideas?


More information about the Python-list mailing list