Library os.path.isfile(filename) - long filenames error. 
Author Message
 Library os.path.isfile(filename) - long filenames error.

I have a filename which is about 90 chars in length, three character
extension.

The python os.path.isfile() function gets a system error:
"Filename or extension is too long." when tested on this file..

Anyone come up against this or know a workaround?

I also have {*filter*} characters like spaces, +, = and - in the filename
just for fun, so have to test filename as:

"c:\path\path\path\kddf-slgjsfdljgklsj+=lkjdlfks
jdlfkjsdk_lfjsdklfj+=ljk sjflksdj fklsdjf.ext"



Tue, 18 May 2004 18:05:35 GMT  
 Library os.path.isfile(filename) - long filenames error.

Quote:

> The python os.path.isfile() function gets a system error:
> "Filename or extension is too long." when tested on this file..

> "c:\path\path\path\kddf-slgjsfdljgklsj+=lkjdlfks
> jdlfkjsdk_lfjsdklfj+=ljk sjflksdj fklsdjf.ext"

There's no reason that filename shouldn't work, although
as written you might be implying it has an embedded newline
(between the two lines? or is that just a space) and
in addition you might want to use one of the following

 "c:\\path\\path\\path\\kddf- .....
 r"c:\path\path\path\kddf- ...
 "c:/path/path/path/kddf- ...

(because without those, in some cases, the backslash
before the character will turn it into a special code,
such as if you had c:\test\test which has embedded tabs).

os.path.isfile() returned true on my machine (Win 98)
for that filename.

Best answer if you can't figure it out: type it in
the interactive prompt and then cut and paste the
resulting error message (and what you typed!) into
the newsreader window and post that.

--
----------------------
Peter Hansen, P.Eng.



Tue, 18 May 2004 21:40:56 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Long Filenames okay for physical filenames???

2. DOS 8.3 filenames (how to remove long filenames header)

3. Unicode filenames and os.path.* functions

4. How to Specify Variable FileName(!FileName)In Report

5. Using variable filename(!FILENAME)

6. REQUIRES filename (NEEDS filename)

7. from os.path import isfile

8. Adding PC Filename Extensions to Macintosh Filenames

9. Get Full Path from MacDirID or Filename?

10. Using Variable Filenames and Paths

11. Filename without path

12. determine path and filename

 

 
Powered by phpBB® Forum Software