Re: Filepath string manipulation help

2005-11-04 Thread mjakowlew
Steve, the os commands don't run through zope, it denies access to them to be run at all through the webserver. So in turn, I had to use a work around to fix the IE problem. Also qwwee's suggestion to use: filepath.split('\\')[-1] works well too. Zope is very finicky about running specific

Re: Filepath string manipulation help

2005-11-04 Thread Steve Holden
mjakowlew wrote: Steve, the os commands don't run through zope, it denies access to them to be run at all through the webserver. So in turn, I had to use a work around to fix the IE problem. Also qwwee's suggestion to use: filepath.split('\\')[-1] works well too. Zope is very finicky

Re: Filepath string manipulation help

2005-11-04 Thread robert . dowell
I just assumed he had heard of me and knew better than to take my advice. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Filepath string manipulation help

2005-11-03 Thread mjakowlew
Thanks guys. The os.path method works, but this is for a script for a website upload program on a zope webserver. For some reason even admin access won't let me run the script through the server. The main issue with my script is that Firefox has no problem with the program the way it is, but IE

Re: Filepath string manipulation help

2005-11-03 Thread qwweeeit
Hi mjakowlew, to get file basename in Linux I use simply: filepath.split('/')[-1] But in Windows, being the dir separator '\', you get into trouble if the dir or file name begins with one of the escape sequences: \a ASCII Bell(BEL) \x07 \b ASCII Backspace (BS) \x08 \f

Re: Filepath string manipulation help

2005-11-03 Thread mjakowlew
I got the IE Fix working, here's the code: path = r'c:\here\there\files\file.ext' i=len(path) j=0 size=len(path) while i: i=i-1 if path[i]== '\\': j=i+1 break filename = path[j:size] print FILENAME: %s %(filename) ___ Most

Re: Filepath string manipulation help

2005-11-03 Thread Steve Holden
mjakowlew wrote: I got the IE Fix working, here's the code: path = r'c:\here\there\files\file.ext' i=len(path) j=0 size=len(path) while i: i=i-1 if path[i]== '\\': j=i+1 break filename = path[j:size] print FILENAME: %s %(filename)

Filepath string manipulation help

2005-11-02 Thread mjakowlew
Hi, I'm trying to use some string manipulation from a file's path. filepath='c:\documents\web\zope\file.ext' I need to extract everthing after the last '\' and save it. I've looked around and have tried the sub, search, match commands, but I'm guessing '\' is set aside for switches. I need to

Re: Filepath string manipulation help

2005-11-02 Thread robert . dowell
import os print os.path.basename(filepath) -- http://mail.python.org/mailman/listinfo/python-list

Re: Filepath string manipulation help

2005-11-02 Thread Fredrik Lundh
mjakowlewwrote: filepath='c:\documents\web\zope\file.ext' I need to extract everthing after the last '\' and save it. that string doesn't contain what you think it does: filepath='c:\documents\web\zope\file.ext' filepath 'c:\\documents\\web\\zope\x0cile.ext' print filepath