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

2005-07-17 Thread J.Bijsterbosch
Hello James,

James Dennett [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
 J.Bijsterbosch wrote:

[ snip ]
 and didn't remember Windows uses path names which need special
 treatment.
 
  Hmm, what you call special treatmentg 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...;-))

 Actually, it does have a connection to Windows.

 On Unix, backslashes are rarely used for anything *except* escape
 characters.  Pathnames tend not to include backslashes, so in most
 cases it's not necessary to escape backslashes in path names.

I knowg, I've had mandrake installed for some time until that pc died on
me, the pc that is, not mandrake...

 On Windows, however, backslash is a valid path separator, and must be
 escaped.

 So, on Unix, for a path separator, you type /.  On Windows you
 can either do the same, or type \\.  (Or (ab)use raw strings.)

Okay, point taken, but I still think it's more a C(++) string thing than a
Windows
issue. I could of course argue that the backslash path separator is there
for backward
compatebility with Dos, but I won't, much to off topic...;-))

  James

Greetings from overcast Amsterdam,

Jan


-- 
http://mail.python.org/mailman/listinfo/python-list


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

2005-07-15 Thread J.Bijsterbosch
Hello Edward,

Edvard Majakari [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
 Thorsten Kampe [EMAIL PROTECTED] 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 treatmentg 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


-- 
http://mail.python.org/mailman/listinfo/python-list