Import no longer works in Python 2.3.x

Matt Whiteley matt at
Fri Feb 13 17:26:50 CET 2004

Hmmm, that messes up all my imports from all over my code and it's all
worked before so I'd rather not. I also wanted the code to be able to run
straight out of the box without people having to hard code the paths.

Thanks anyway though!

"Graham Fawcett" <graham__fawcett at> wrote in message
news:e9570f37.0402112041.1890c686 at
> "Matt Whiteley" <matt at> wrote in message
news:<w6wWb.1$MQ1.0 at>...
> > I have some python code in a directory called customModules and this
> > under the main directory which contains a piece of code. Under
> > 2.1.x and 2.2.x, I did the following in :
> >
> > import time, sys
> > sys.path += ['./customModules']
> >
> > from requestHandler import inputHandler
> >
> > and that allowed me to reference the requestHandler (stored in the
> > customModules directory) code without having to use
> > customModules.requestHandler every time. Under 2.3.x this doesn't work
> > anymore and I get a "ImportError: cannot import name inputHandler"
> > Can anyone shed some light on why this is and how I can get around it
> > please.
> Unless there's something going on here that's not clear from your
> example, you can just add an to your customModules
> directory, and then use
> from customModules.requestHandler import inputHandler
> Adding creates a "pacakge" out of the subdirectory, and
> obviates the sys.path manipulations. See the "Packages" section at
> for more information.
> -- Graham

More information about the Python-list mailing list