Re: [Tutor] os.path.basename() issue with path slashes

2010-02-20 Thread Steven D'Aprano
On Sun, 21 Feb 2010 10:49:19 am Dayo Adewunmi wrote: > Hi all, > > This script I'm working on, should take all the image files in the > current directory and generate an HTML thumbnails. > > import os > import urllib You import urllib, but don't appear to use it anywhere. > > # Generate thumbnail

Re: [Tutor] os.path.basename() issue with path slashes

2010-02-20 Thread Shashwat Anand
> > > > If you're using OS functions you should NOT bank on the slashes being > forward-slashes. This is platform-specific behavior. You should use > os.path.split() to get the elements of your path and do a "/".join() on > them. Otherwise your code will break on Windows because the path will be

Re: [Tutor] os.path.basename() issue with path slashes

2010-02-20 Thread Luke Paireepinart
On Sat, Feb 20, 2010 at 6:11 PM, Dayo Adewunmi wrote: > Shashwat Anand wrote: > >> >> >> >> >> for dirname, subdirname, filenames in os.walk(absolutePath): >> for filename in filenames: >> print "" >>%(currentdir,filename,currentdir,filename) >> >> >> I see a small

Re: [Tutor] os.path.basename() issue with path slashes

2010-02-20 Thread Dayo Adewunmi
Shashwat Anand wrote: for dirname, subdirname, filenames in os.walk(absolutePath): for filename in filenames: print "" %(currentdir,filename,currentdir,filename) I see a small typo here. print "" %(currentdir,filename,currentdir,filename) should rather

Re: [Tutor] os.path.basename() issue with path slashes

2010-02-20 Thread Shashwat Anand
> > for dirname, subdirname, filenames in os.walk(absolutePath): > for filename in filenames: > print "" > %(currentdir,filename,currentdir,filename) > > I see a small typo here. print "" %(currentdir,filename,currentdir,filename) should rather be print "" %(currentdir,filenam

[Tutor] os.path.basename() issue with path slashes

2010-02-20 Thread Dayo Adewunmi
Hi all, This script I'm working on, should take all the image files in the current directory and generate an HTML thumbnails. import os import urllib # Generate thumbnail gallery def genThumbs(): # Get current directory name absolutePath = os.getcwd() urlprefix = "http://kili.org/~day