Module imports fine from interactive, not from script

Steve Holden steve at holdenweb.com
Thu May 24 12:32:44 EDT 2007


Joshua J. Kugler wrote:
> Yes, I've read this:
> http://mail.python.org/pipermail/python-list/2006-August/395943.html
> That's not my problem.
> 
> I installed PlanetPlanet <http://www.planetplanet.org/> via the
> package's "setup.py install" command (as root).  planet.py will not run,
> however, giving me this error:
> 
> Traceback (most recent call last):
>   File "/usr/local/bin/planet.py", line 167, in ?
>     main()
>   File "/usr/local/bin/planet.py", line 124, in main
>     planet.logging.basicConfig()
> AttributeError: 'module' object has no attribute 'logging'
> 
> But, from interactive session:
> 
> jkugler at europa:~/www$ ls -l # to show that the modules are not in the
> current dir
> total 20
> -rw-r--r-- 1 jkugler jkugler 2247 2007-05-22 15:26 atom.xml.tmpl
> -rw-r--r-- 1 jkugler jkugler 2089 2007-05-22 15:25 index.html.tmpl
> -rw-r--r-- 1 jkugler jkugler  564 2007-05-22 15:43 planet.ini
> -rw-r--r-- 1 jkugler jkugler 1128 2007-05-22 15:26 rss10.xml.tmpl
> -rw-r--r-- 1 jkugler jkugler  838 2007-05-22 15:26 rss20.xml.tmpl
> jkugler at europa:~/www$ python
> Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import planet
>>>> planet.logging
> <module 'planet.logging'
> from '/usr/local/lib/python2.4/site-packages/planet/logging/__init__.py'>
>>>> planet.logging.basicConfig()
>>>>
> 
> The contents of /usr/local/lib/python2.4/site-packages/planet
> jkugler at europa:~/www$ ls -la /usr/local/lib/python2.4/site-packages/planet/
> total 270
> drwxr-sr-x 4 root staff   1024 2007-05-22 16:59 .
> drwxrwsr-x 4 root staff   1024 2007-05-22 15:18 ..
> -rw-r--r-- 1 root staff   4315 2006-07-26 15:53 atomstyler.py
> -rw-r--r-- 1 root staff   8887 2006-07-26 15:53 cache.py
> -rw-r--r-- 1 root staff 126446 2006-07-26 15:53 feedparser.py
> -rw-r--r-- 1 root staff  58705 2006-07-26 15:53 htmltmpl.py
> -rw-r--r-- 1 root staff  38145 2006-07-26 15:53 __init__.py
> drwxr-xr-x 2 root staff   1024 2007-05-22 16:59 logging
> -rw-r--r-- 1 root staff  13904 2006-07-26 15:53 sanitize.py
> drwxr-xr-x 2 root staff   1024 2007-05-22 16:59 tests
> -rw-r--r-- 1 root staff  12681 2006-07-26 15:53 timeoutsocket.py
> 
> planet.py is simply executing:
> 
> import planet
> .
> .
> .
>     # Activate logging
>     planet.logging.basicConfig()
> 
> 
> I've checked permissions, I've checked import statements, everything I know
> to check.  Is there something terribly simple I'm missing?
> 
> Thanks!
> 
> j
> 
The directory containing the script you are executing is also added to 
sys.path. Since you are executing a script called planet ...

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogspot.com        squidoo.com/pythonology
tagged items:         del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------




More information about the Python-list mailing list