Peculiar ImportError traceback

John J. Lee jjl at pobox.com
Tue Sep 3 12:56:57 EDT 2002


>>> from mx import DateTime
*** You don't have the (right) mxDateTime binaries installed !
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "mx/DateTime/__init__.py", line 8, in ?
    from DateTime import *
  File "mx/DateTime/DateTime.py", line 9, in ?
    from mxDateTime import *
  File "/usr/local/lib/python2.2/site-packages/reportlab/__init__.py", line 13, in ?
    myDir = os.path.split(__file__)[0]
ImportError: No module named mxDateTime
>>> from mx.DateTime import mxDateTime
>>>


Two obvious problems:

1. Bizarre last line of traceback involving reportlab (whose
__init__.py I list in full below).  Reportlab and mxDateTime, AFAIK,
are entirely unrelated!

2. mxDateTime's __init__.py (mx/DateTime/mxDateTime/__init__.py) does
an import mxDateTime, which then fails, causing the error message
about mxDateTime's binaries (ie. mxDateTime.so) to be printed.
Obviously, Python isn't finding the library, but I can't remember how
extension modules are located, nor could I find anything in the Python
docs on this -- could anyone point it out for me?

Even better, explain why on earth I get that line about reportlab!  Up
until now reportlab has sat in /usr/local/lib/python2.2/site-packages
quietly minding its own business.  The egenix-mx-base `mx' directory
(2.0.3) is also in the same site-packages directory.  Grepping through
reportlab, I see that one of its demos making use of mxTextTools, but
I don't think that's relevant.


John

#copyright ReportLab Inc. 2000-2001
#see license.txt for license details
#history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/__init__.py?cvsroot=reportlab
#$Header: /cvsroot/reportlab/reportlab/__init__.py,v 1.16 2001/08/13 12:17:12 rgbecker Exp $
__version__=''' $Id: __init__.py,v 1.16 2001/08/13 12:17:12 rgbecker Exp $ '''
__doc__="""The Reportlab PDF generation library."""
Version = "1.09"

def getStory(context):
    if context.target == 'UserGuide':
        # parse some local file
        import os
        myDir = os.path.split(__file__)[0]
        import yaml
        return yaml.parseFile(myDir + os.sep + 'mydocs.yaml')
    else:
        # this signals that it should revert to default processing
        return None




More information about the Python-list mailing list