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('symbolic_link') if

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 pengyu...@gmail.com 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

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 import stat import os st =

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 way to do so? $cat main.py import

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 pengyu...@gmail.com 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

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

2009-10-28 Thread Ben Finney
Peng Yu pengyu...@gmail.com 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: import os.path