[Tutor] can't import module
Dave S
pythontut at pusspaws.net
Sun Jul 2 18:30:03 CEST 2006
On Sunday 02 July 2006 17:02, Dave Kuhlman wrote:
> On Sun, Jul 02, 2006 at 11:55:24AM +0100, Dave S wrote:
>
> [snip]
>
> > Thanks for replying :)
> >
> > The app is fairly big and distributed around the gg1.4 directory. I get
> > the feeling that 'from logger import log' is the first of a lot of import
> > problems, this script alone imports from another 7 modules
> >
> > from urllib import urlopen
> > from time import strftime
> > from cPickle import dump
> > from datetime import datetime, time, timedelta
> > from os import remove
> >
> > from logger import log
> > from html_strip import html_strip
> > from garbage_collect import garbage_collect
> > from valid_day import valid_day
> > from exact_sleep import sleep_delay,sleep_until
> > from cookie_string import cookie_string
> > from data_core import Data_Core
> >
> > from config import data_dir,HTML_addr, ipc_dir
>
> So, ask yourself: Where is logger.py? Modules logger,
> html_strip, etc are not it the Python standard library (see:
> http://docs.python.org/lib/lib.html). Are they in your
> application? Are (were) they in some package that you had
> previously installed (but that needs to be re-installed)?
>
They are all from my fair hand - coded about a year ago. I have just copied
the whole directory to my new dapper system, changed PYTHONPATH and was
somewhat supprised it has not just worked.
> One possible explanation for your problem is that when you
> upgraded from Ubuntu/Kubuntu breezy to dapper, you also upgraded
> from Python 2.3 to Python 2.4. If so, Python is now importing
> from:
>
> /usr/lib/python2.4/site-packages/
>
> instead of:
>
> /usr/lib/python2.3/site-packages/
I see your point but because these are all my own packages I would guess the
python version would be irrelevant
>
> If so, there might be Python modules that need to be re-installed
> by running Python 2.4 (instead of Python 2.3). I know that on my
> Kubuntu system, there is both Python 2.4 and 2.3.
>
> If the above is *not* the problem, then you need to find out where
> your application used to find these modules (e.g. logger). That
> will help you (or someone on this list) figure out how to enable
> Python and your live_datad.py application to find them.
OK I am going to try a couple of real basic scripts and import a module to see
where it all falls down. I will email back with the results :)
Cheers
Dave
>
> Hope this helps.
>
> Dave K.
>
> [snip]
More information about the Tutor
mailing list