[Tutor] os.symlink can't find target

2014-02-24 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 My operating system is Linux (openSUSE 13.1). I'm trying to create symlinks. The following code: if pathList[j][-3:] == "mp3": linkName1 = pathList[j][0:-3] + "mp3" linkName2 = destPath + linkName1[len(sourcePath):] print 'Creating link %

Re: [Tutor] os.symlink can't find target

2014-02-24 Thread Peter Otten
Bob Williams wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > My operating system is Linux (openSUSE 13.1). > > I'm trying to create symlinks. The following code: > > if pathList[j][-3:] == "mp3": > linkName1 = pathList[j][0:-3] + "mp3" > linkName2 = destPath + linkName1[len

Re: [Tutor] os.symlink can't find target

2014-02-24 Thread Mark Lawrence
On 24/02/2014 16:36, Peter Otten wrote: Bob Williams wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 My operating system is Linux (openSUSE 13.1). I'm trying to create symlinks. The following code: if pathList[j][-3:] == "mp3": linkName1 = pathList[j][0:-3] + "mp3" linkName2 =

Re: [Tutor] os.symlink can't find target

2014-02-24 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 24/02/14 16:36, Peter Otten wrote: > os.symlink(existing_file, symlink_to_create) > > fails with that error if the directory that shall contain the new > symlink does not exist. You can create it before making the symlink > with > Peter, Many tha

Re: [Tutor] os.symlink can't find target

2014-02-24 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 24/02/14 16:56, Mark Lawrence wrote: > On 24/02/2014 16:36, Peter Otten wrote: >> Bob Williams wrote: >> [...] >>> Thanks, >> >> os.symlink(existing_file, symlink_to_create) >> >> fails with that error if the directory that shall contain the new

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Cameron Simpson
Hi Bob, I notice your problem is solved, but I've got a few remarks about your script and also how you might have investigated your problem. First: the os.foo calls are usually very thin wrappers for the corresponding OS call. So if you get an errno type error for os.symlink, it is worth running:

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread David
On 26 February 2014 16:31, Cameron Simpson wrote: > > You need to know that ENOENT is errno 2 "No such file or directory", > but it helps. In case it helps anyone, there is information in the python documentation of the errno module that associates system error numbers with their corresponding me

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Cameron, Many thanks for your helpful comments. I do still have some problems with my script, but it's probably better to start a new thread with an appropriate subject. I'm a bit new to Python, so it still seems like magic sometimes (someone else

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Dave Angel
Bob Williams Wrote in message: > >>> linkName1 = pathList[j][0:-3] + "mp3" >> >> Isn't this exactly the same as pathList[j] ? >> > Actually, no. pathList[j] can contain either .mp3 files or .flac > files. In fact the main function of the script is to run all the flacs > through lame to conver

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 26/02/14 15:41, Bob Williams wrote: On 26/02/14 05:31, Cameron Simpson wrote: >>> linkName1 = pathList[j][0:-3] + "mp3" >>> >>> Isn't this exactly the same as pathList[j] ? >>> > Actually, no. Actually, you are right. I've trimmed down that block

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Cameron Simpson
On 26Feb2014 15:41, Bob Williams wrote: > Many thanks for your helpful comments. I do still have some problems > with my script, but it's probably better to start a new thread with an > appropriate subject. Very true. > I'm a bit new to Python, so it still seems like magic sometimes > (someone e