import logging fails on MacPython 2.4.3

T

Tod Olson

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:

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 <[email protected]>
Programmer/Analyst
University of Chicago Library
 
D

Diez B. Roggisch

Tod said:
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
 
T

Tod Olson

Diez said:
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
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top