[Tutor] os.symlink can't find target
Bob Williams
linux at barrowhillfarm.org.uk
Mon Feb 24 18:03:51 CET 2014
-----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 thanks. I was fixating on the existing_file, not realising I had
to create a home for the symlink first.
> try: os.makedirs(os.path.dirname(symlink_to_create)) except OSError
> as err: # Assume the directory exists. # A thorough coder would
> check the errno here pass
Regards
Bob
- --
Bob Williams
System: Linux 3.11.10-7-desktop
Distro: openSUSE 13.1 (x86_64) with KDE Development Platform: 4.12.2
Uptime: 12:00pm up 11 days 20:00, 5 users, load average: 0.14, 0.17, 0.22
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlMLe3QACgkQ0Sr7eZJrmU6QmQCeLUSIh0l97T017KrIHXT92Xhd
YuQAn2To2AOXNpbA4fZ+4i6Swt4RdsMg
=NgLw
-----END PGP SIGNATURE-----
More information about the Tutor
mailing list