Re: Issue with zipfile and symbolic link

2017-05-30 Thread MRAB
On 2017-05-30 08:45, loial wrote: I am reading a list of pdf files from a directory which is a symbolic link and adding them to a zip file. Issue I have is that the zip files are being added as empty directories rather than the actual pdf files. My code is below. Any idea why this happening

Issue with zipfile and symbolic link

2017-05-30 Thread loial
I am reading a list of pdf files from a directory which is a symbolic link and adding them to a zip file. Issue I have is that the zip files are being added as empty directories rather than the actual pdf files. My code is below. Any idea why this happening? # ZIP pdfs subdirectory

Re: How to get the realpath of a symbolic link?

2009-10-31 Thread Terry Reedy
Peng Yu wrote: I find the following two files that define realpath. But I don't find 'realpath' in os.py. I looked at 'os.py'. But I don't understand how the function realpath is introduced in the name space in os.path. Would you please let me know? gfind . ! -path '*backup*' -name "*.py" -type

Re: How to get the realpath of a symbolic link?

2009-10-31 Thread Wolodja Wentland
On Sat, Oct 31, 2009 at 14:48 -0500, Peng Yu wrote: > On Sat, Oct 31, 2009 at 1:46 PM, Terry Reedy wrote: > > Peng Yu wrote: [ snip ] > I find the following two files that define realpath. But I don't find > 'realpath' in os.py. I looked at 'os.py'. But I don't understand how > the function realp

Re: How to get the realpath of a symbolic link?

2009-10-31 Thread Peng Yu
tory and files. I want to get >>>> the canonical path of a file, a directory or a symbolic link. >>>> For example, for 'b' below, I want to get its canonical path as >>>> '/private/tmp/abspath/b'. >>> >>> So, why i

Re: How to get the realpath of a symbolic link?

2009-10-31 Thread Peng Yu
ibe. I use the following example to show what I want. >> >> In my example in the original post, >> >> '/tmp/abspath/b' is a symbolic link to '/tmp/abspath/a' and '/tmp' is >> a symbolic link to '/private/tmp'. >> >> The

Re: How to get the realpath of a symbolic link?

2009-10-31 Thread Terry Reedy
Peng Yu wrote: On Sat, Oct 31, 2009 at 11:26 AM, Emile van Sebille wrote: On 10/31/2009 12:03 AM Peng Yu said... Suppose that I have the following directory and files. I want to get the canonical path of a file, a directory or a symbolic link. For example, for 'b' below, I want

Re: How to get the realpath of a symbolic link?

2009-10-31 Thread Emile van Sebille
the original post, > > '/tmp/abspath/b' is a symbolic link to '/tmp/abspath/a' and '/tmp' is > a symbolic link to '/private/tmp'. > > Therefore, I want to get '/private/tmp/abspath/b', rather than > '/private/tmp/abspath/a&#

Re: How to get the realpath of a symbolic link?

2009-10-31 Thread Peng Yu
On Sat, Oct 31, 2009 at 11:26 AM, Emile van Sebille wrote: > On 10/31/2009 12:03 AM Peng Yu said... >> >> Suppose that I have the following directory and files. I want to get >> the canonical path of a file, a directory or a symbolic link. >> For example, for &

Re: How to get the realpath of a symbolic link?

2009-10-31 Thread Emile van Sebille
On 10/31/2009 12:03 AM Peng Yu said... Suppose that I have the following directory and files. I want to get the canonical path of a file, a directory or a symbolic link. For example, for 'b' below, I want to get its canonical path as '/private/tmp/abspath/b'. So, why isn&#x

How to get the realpath of a symbolic link?

2009-10-31 Thread Peng Yu
Suppose that I have the following directory and files. I want to get the canonical path of a file, a directory or a symbolic link. For example, for 'b' below, I want to get its canonical path as '/private/tmp/abspath/b'. However, os.path.abspath('b') gives me

Re: How to test if a file is a symbolic link?

2009-10-28 Thread Ben Finney
Peng Yu writes: > 'symbolic_link' is a symbolic link in the current directory. I run > 'python main.py', but it does not return me anything. I want to check > if a file is a symbolic link. You have the same access to the Python help as we do: >>> imp

Re: How to test if a file is a symbolic link?

2009-10-28 Thread ma
import os if os.path.islink('symbolic_link'): print "hello." Cheers, Mahmoud Abdelkader On Oct 28, 2009, at 11:19 PM, Peng Yu wrote: 'symbolic_link' is a symbolic link in the current directory. I run 'python main.py', but it does not return me

Re: How to test if a file is a symbolic link?

2009-10-28 Thread Steven D'Aprano
On Wed, 28 Oct 2009 22:19:55 -0500, Peng Yu wrote: > 'symbolic_link' is a symbolic link in the current directory. I run > 'python main.py', but it does not return me anything. I want to check if > a file is a symbolic link. I'm wondering what is the correct

Re: How to test if a file is a symbolic link?

2009-10-28 Thread tec
On 2009-10-29 11:19, Peng Yu wrote: 'symbolic_link' is a symbolic link in the current directory. I run 'python main.py', but it does not return me anything. I want to check if a file is a symbolic link. I'm wondering what is the correct way to do so? $cat main.py

Re: How to test if a file is a symbolic link?

2009-10-28 Thread D'Arcy J.M. Cain
On Wed, 28 Oct 2009 22:19:55 -0500 Peng Yu wrote: > 'symbolic_link' is a symbolic link in the current directory. I run > 'python main.py', but it does not return me anything. I want to check > if a file is a symbolic link. I'm wondering what is the correct

How to test if a file is a symbolic link?

2009-10-28 Thread Peng Yu
'symbolic_link' is a symbolic link in the current directory. I run 'python main.py', but it does not return me anything. I want to check if a file is a symbolic link. I'm wondering what is the correct way to do so? $cat main.py import stat import os st = os.stat('s

Re: Symbolic Link

2007-10-10 Thread samwyse
On Sep 9, 10:05 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message <[EMAIL PROTECTED]>,samwysewrote: > > > A hard-link, OTOH, allows > > direct access to the contents of a file, as long as it is on the same > > filesystem. No extra steps are required, so the pr

Re: Symbolic Link

2007-09-09 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, samwyse wrote: > A hard-link, OTOH, allows > direct access to the contents of a file, as long as it is on the same > filesystem. No extra steps are required, so the process runs a few > microseconds faster, and directory-level permissions can't get in the way. Har

Re: Symbolic Link

2007-09-09 Thread samwyse
g to make a link in a browser friendly area so I >>>>can use it to display an image file. >> >>My question would be why a symbolic link? Why not a hard link? Are the >>two directories on different mount points? After the script finishes >>does python need to see t

Re: Symbolic Link

2007-08-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Ian Clark wrote: > My question would be why a symbolic link? Why not a hard link? Because of the potential for confusion. For instance, modifying the file without realizing that some other place expects to see the unmodified version. -- http://mail.p

Re: Symbolic Link

2007-08-23 Thread mosscliffe
Assuming your hosting service will allow that, then it should work. > > If not, then why not just copy the image files? Storage is cheap > > these days. > > > Hyuga > > My question would be why a symbolic link? Why not a hard link? Are the > two directories on different

Re: Symbolic Link

2007-08-21 Thread Ian Clark
e image files? Storage is cheap > these days. > > Hyuga > My question would be why a symbolic link? Why not a hard link? Are the two directories on different mount points? After the script finishes does python need to see that image file again? Why not just move it? Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Symbolic Link

2007-08-20 Thread Hyuga
On Aug 19, 4:29 pm, mosscliffe <[EMAIL PROTECTED]> wrote: > The source file is in an area which python can see, but not the > browser. I am trying to make a link in a browser friendly area so I > can use it to display an image file. You might want to try using an .htaccess file. Place a file cal

Re: Symbolic Link

2007-08-19 Thread mosscliffe
On 19 Aug, 13:16, samwyse <[EMAIL PROTECTED]> wrote: > mosscliffewrote: > > I am trying to create a link to a file, which I can then use in an > > HTML page. > > > The system is Linux on a hosted web service, running python 2.3. > > Other than that I have no knowledge of the system. > > > The link

Re: Symbolic Link

2007-08-19 Thread samwyse
mosscliffe wrote: > I am trying to create a link to a file, which I can then use in an > HTML page. > > The system is Linux on a hosted web service, running python 2.3. > Other than that I have no knowledge of the system. > > The link is created OK, but when I try to use it as filename for the >

Re: Symbolic Link

2007-08-19 Thread Diez B. Roggisch
mosscliffe schrieb: > On 18 Aug, 23:49, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> mosscliffe schrieb: >> >> >> >>> I am trying to create a link to a file, which I can then use in an >>> HTML page. >>> The system is Linux on a hosted web service, running python 2.3. >>> Other than that I have

Re: Symbolic Link

2007-08-18 Thread mosscliffe
On 18 Aug, 23:49, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > mosscliffe schrieb: > > > > > I am trying to create a link to a file, which I can then use in an > > HTML page. > > > The system is Linux on a hosted web service, running python 2.3. > > Other than that I have no knowledge of the sys

Re: Symbolic Link

2007-08-18 Thread Diez B. Roggisch
mosscliffe schrieb: > I am trying to create a link to a file, which I can then use in an > HTML page. > > The system is Linux on a hosted web service, running python 2.3. > Other than that I have no knowledge of the system. > > The link is created OK, but when I try to use it as filename for the

Symbolic Link

2007-08-18 Thread mosscliffe
I am trying to create a link to a file, which I can then use in an HTML page. The system is Linux on a hosted web service, running python 2.3. Other than that I have no knowledge of the system. The link is created OK, but when I try to use it as filename for the IMG TAG, it does not get displayed