trouble importing modules

Brandon Metcalf bmetcalf at nortel.com
Thu Jul 14 13:19:56 EDT 2005


I come from a Perl and C background and have been given an application
written in Python to maintain and I know very little about Python.
I'm having trouble at run time with importing modules.  Specifically,
in several places time.strptime() is being used and Freeze is being
used to produce binaries for each platform where this application
runs.  _strptime.py is also being supplied with the binaries.

The first problem I encountered coming from _strptime.py was:

  ImportError: No module named calendar

_strptime.py imports calendar, but my thought was that since freeze
isn't being run against _strptime.py directly, the calendar module may
not be getting built into the resulting binary.  So, I added "import
calendar" to the file I'm running freeze against.  This fixed
(probably not in the proper way) the above error, but now I'm getting
from calendar.py:

  ImportError: No module named datetime

So, my question is how can I ensure that all modules that
_strptime.py, calendar.py, etc. rely are built in the resulting
binaries without having to import everything explicitly in my code?

I'm using Python 2.3.4.

Thanks.

-- 
Brandon



More information about the Python-list mailing list