471,624 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

import logging fails on MacPython 2.4.3

Anyone have advice for importing the logging module using MacPython 2.4.3?

MacPython installs the logging module in:

/Library/Frameworks/Python.framework/Versions/2.4/lib/logging/

There's an __init__.py there and everything, but this directory is not
in sys.path. I add it to sys.path as follows:
>>sys.path.append(os.path.join(sys.prefix, 'lib', 'logging'))
print sys.path[-1]
/Library/Frameworks/Python.framework/Versions/2.4/lib/logging

But even so, the logging module is not found:
>>import logging
Traceback (most recent call last):
File "<pyshell#7>", line 1, in -toplevel-
import logging
ImportError: No module named logging

Now, I've been away from Python for some years, so I'm pretty rusty.
Maybe there's something obvious I'm missing. Any advice on how to
proceed would be welcome.

Tod Olson <to*@uchicago.edu>
Programmer/Analyst
University of Chicago Library
Aug 9 '06 #1
2 1763
Tod Olson schrieb:
Anyone have advice for importing the logging module using MacPython 2.4.3?

MacPython installs the logging module in:

/Library/Frameworks/Python.framework/Versions/2.4/lib/logging/
On my machine, that is
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/logging
There's an __init__.py there and everything, but this directory is not
in sys.path. I add it to sys.path as follows:
>>sys.path.append(os.path.join(sys.prefix, 'lib', 'logging'))
>>print sys.path[-1]
/Library/Frameworks/Python.framework/Versions/2.4/lib/logging

Which is wrong - you'd have to add the path without the logging part!

Diez
Aug 9 '06 #2
Diez B. Roggisch wrote:
Tod Olson schrieb:
>Anyone have advice for importing the logging module using MacPython
2.4.3?

MacPython installs the logging module in:

/Library/Frameworks/Python.framework/Versions/2.4/lib/logging/

On my machine, that is
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/logging
That's good to hear, as it agrees with the other Python installations
I've examined. That locations makes much more sense than where it landed
on my machine.
>There's an __init__.py there and everything, but this directory is not
in sys.path. I add it to sys.path as follows:
> >>sys.path.append(os.path.join(sys.prefix, 'lib', 'logging'))
print sys.path[-1]
/Library/Frameworks/Python.framework/Versions/2.4/lib/logging


Which is wrong - you'd have to add the path without the logging part!
Great, thanks!

-Tod
Aug 9 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

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.