How can I import a py script by its absolute path name?

J.Bijsterbosch j.bijsterbosch at hccnet.nl
Thu Jul 14 14:43:41 EDT 2005


Hello Edward,

"Edvard Majakari" <edvard+news at majakari.net> schreef in bericht
news:87ackpeeag.fsf at titan.staselog.com...
> Thorsten Kampe <thorsten at thorstenkampe.de> writes:
>
> > "sys.path.append('c:\\xxx\\yyy')" or "sys.path.append('c:/xxx/yyy')"
>
> Well, of course. As I said, it was untested :) I just copied the path
string,
> and didn't remember Windows uses path names which need special
> treatment.

Hmm, what you call special treatment<g> comes from pythons deep underlying C
and C++ language heietidge I presume. A backslash in a C or C++ string means
the following character is a so called escape character, like \n represents
a newline and \r a return to the beginning of a line.
If you really want a backslash you need to type it twice like so \\. Has
nothing to do with Windows...;-))

Greetings from sunny Amsterdam,

    Jan





More information about the Python-list mailing list