Importing from Another Path
ykingma at accessforall.nl
Wed Jul 25 16:11:59 EDT 2001
Paul Sidorsky wrote:
> Ype Kingma wrote:
> > > sys.path.append("..\\common")
> > That is almost as portable as it gets: when also you take
> > the common directory from the command line sys.argv, eg:
> > sys.path.append(sys.argv)
> > I wouldn't know of a more portable way.
> > The non portable part is then moved into the script(s) that
> > start(s) the client and the server.
> Actually I just meant that it wasn't portable between Windows and Linux
> because I'm using backslashes in the path.
Have a look at os.path.normpath(), os.path.normcase(), and
> It looks like I'll have to just clean it up to use os.path.join() to
> take care of that and live with it the way I've got it. This is not the
> answer I was hoping to hear, but at least it's an answer. Thanks!
File system naming depends on the file system, there is no way
around that. os.path can help you keep your file names compatible
enough to use file names in your python source on both systems.
But most programs need a startup script anyway, so I prefer
to take the file names from sys.argv.
email at xs4all.nl
More information about the Python-list