473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Linux info

Hello there,

I still learning, but I couldn't find anything which tells me where a
symlink is pointing to.
A part of os.system('ls -l ' + path) and cutting down to the need, I haven't
got any specialized function.

F
Jun 13 '06 #1
3 1161
os.path.realpath

TheSaint wrote:
Hello there,

I still learning, but I couldn't find anything which tells me where a
symlink is pointing to.
A part of os.system('ls -l ' + path) and cutting down to the need, I haven't
got any specialized function.

F


Jun 13 '06 #2
os.system('ls -lL ' + path)
should also work. But check, I may be wrong about the L option, and am
not near a Linux system right now.

That's "lL" - a small letter l (ell) followed by a capital letter L in
the ls options above.

This way may be slower than os.path.realpath if that is implemented as
a system call, i.e.via Python ->C->Linux kernel, which it probably is.
Slower since my way given above will create a new process to run the ls
command in. Just mentioning it as another way, plus, it does have the
small benefit that it'll work the same way on any other language such
as Perl, Ruby, etc., which supports something similar to os.system().

Vasudev Ram
http://www.geocities.com/vasudevram
PDF conversion tools: http://sourceforge.net/projects/xtopdf
faulkner wrote:
os.path.realpath

TheSaint wrote:
Hello there,

I still learning, but I couldn't find anything which tells me where a
symlink is pointing to.
A part of os.system('ls -l ' + path) and cutting down to the need, I haven't
got any specialized function.

F


Jun 13 '06 #3
On Tue, 13 Jun 2006 22:06:42 +0800, TheSaint <fc********@icqmail.com> wrote:
Hello there,

I still learning, but I couldn't find anything which tells me where a
symlink is pointing to.
os.readlink()
os.lstat()

And they are /not/ Linux-specific; expect them to work on most or all
Unix-like OSes.
A part of os.system('ls -l ' + path) and cutting down to the need, I haven't
got any specialized function.


Both functions mentioned above are documented as part of module os, section
"Files and Directories".

/Jorgen

--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn!
Jun 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Ranger West | last post by:
Hello there, Are there any out-of-the box handhelds that run Linux/Apache/MYSQL and PHP? Does Redhat, Suse, or Gentoo support any handhelds? I know the Zaurus comes close, but I've heard...
6
by: cantabile | last post by:
Hi, I'd like to get drives and partitions (and their size too) with python under Linux. So far, I thought of reading /proc/partitions but maybe i could use fdsik also ? How would I do that in...
1
by: MWD | last post by:
For anyone looking for info on running raw partitions on Linux, I just found an excellent article on the fundamentals of Raw on Linux. The site is www.idevelopment.info . I found the article by...
15
by: windozbloz | last post by:
Bye Bye Billy Bob... I'm back with one more question, then I'll chill. I have scoured the news and net for info about Borlands KYLIX 3 and have found little technical info about it. Their...
21
by: Travis 'Bailo' Bickel | last post by:
Lately, I have been having a bear of a time trying to acquire a Linux driver for my S3/ProSavage chipset -- but that quest is now almost at an end as I have located a noble band of people who are...
2
by: Brooks Clayton | last post by:
I have a split db created in A97. The backend currently resides on a Windows2000 machine and is accessed by front ends on other 2000 and Win98 machines all running A97, all on our local network. ...
0
by: nass | last post by:
hello everyone and happy new year. i am not sure how to tackle this problem or where is originates from so i am writing here in hope that if you can not help you can at least point me in a...
9
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
31
by: arun | last post by:
I know it is a free compiler. But does it follow any standard? If so which standard is it? (Ansi, Ecma, etc?)
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.