English is my first language, but I doesn't be very good at it.
I was trying to endow my symlinked python module with the ability to
divine where it actually resides when I came across os.readlink(),
documented at http://docs.python.org/lib/os-file-dir.html
I'm not sure readlink() lives up to its documentation. To wit:
$ touch bar # Create an empty file
$ ln -s bar foo # And a symlink to it.
$ python
Python 2.5.1 <... Herald "the snitch" Redacted ...>
Type "help", "copyright" , "credits" or "license" for more information.
>>import os, os.path path = "foo" result = os.readlink(pat h) result
'bar'
>>abspath = os.path.join(os .path.dirname(p ath), result) os.path.isabs (abspath)
False
>>abspath
'bar'
The result makes sense, but it belies the documentation. Should I report
this? Or is there another plausible interpretation? 2 1732
JBW wrote:
I'm not sure readlink() lives up to its documentation. To wit:
$ touch bar # Create an empty file
$ ln -s bar foo # And a symlink to it.
$ python
Python 2.5.1 <... Herald "the snitch" Redacted ...>
Type "help", "copyright" , "credits" or "license" for more information.
>>>import os, os.path path = "foo" result = os.readlink(pat h) result
'bar'
>>>abspath = os.path.join(os .path.dirname(p ath), result) os.path.isab s(abspath)
False
>>>abspath
'bar'
The result makes sense, but it belies the documentation. Should I report
this? Or is there another plausible interpretation?
the part about joining with dirname(path) assumes that you pass in an
absolute path to the readlink function.
</F>
Fredrik Lundh wrote:
JBW wrote:
>I'm not sure readlink() lives up to its documentation. ... The result makes sense, but it belies the documentation. Should I report this? Or is there another plausible interpretation?
the part about joining with dirname(path) assumes that you pass in an
absolute path to the readlink function.
That documentation should probably say, "if it is relative, it may be
converted to a pathname valid from the current working directory using
...."
-Miles This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chumley the Walrus |
last post by:
I'm trying to parse the selected value from a group of radiobuttons,
but the below code for the radio buttons doesnt work, whereas the one
for the text box does.
<% dim dateinbox, sportsel
dateinbox = TextBox1.text
sportsel = Sport.text %>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:RadioButton id="sport1" GroupName="Sport" text="mlb" value="mlb"
|
by: ayende |
last post by:
I've installed and unistalled SQL Server 2000 and MSDE on my computer
as I needed it (my machine is a development machine).
I've tested SQL Server B2 and then uninstalled it, now when I try to
install SQL Server Express B3 I can't get the client side tools to
install (the command lines).
The server is apperantly working, but I can't log into it because I
don't get any of the clients.
How do I fix this?
|
by: Javaman59 |
last post by:
Hi,
This is a question for DOS programmers, if there are any here... :)
I'm successfully using the command line for c# programming, except for one
thing - I can't startup the SDK documentation from it. To get the SDK doco I
have to startup IE on the "...\SDK\StartHere.htm", and then click the link to
the SDK doco. The item linked to is
"javascript:Link('ms-help://MS.NETFrameworkSDKv1.1/sdkstart/html/sdkstart.htm'".
I've tried every...
|
by: James Butler |
last post by:
Our setup:
Online db: MySQL
Inhouse db: MS Access 97 with MySQL tables linked via ODBC
Our issue:
Almost every field updates successfully, except one.
A scenario:
Information is written to online db.
We run an inhouse query to collect info from online db and update
|
by: Patrick Arkins |
last post by:
I have a Main form (named FRM_Main in the Forms Window) with a Subform
(named FRM_User_Search in the Forms window, form_User_Search on
Forms_Main).
FRM_User_Search has a combo-box (cboSort) the user will hopefully be
able to use to change the sort order of the records on the same form.
Here's the code for the "OnChange" event, minus the
DoCmd.Repaint.Object Line:
| |
by: .Net Sports |
last post by:
Before processing my data in a datagrid, I need to parse the day of the
week (which will be my 'rqsday' variable) from a string that comes over
on a querystring:
string rqs = Request.QueryString;
string rqsday;
rqsday = (System.String.Format("{0:dddd}",rqs)) ;
|
by: Robert Dobson |
last post by:
I've run into a rather perplexing problem and unfortunately nobody has yet
been able to help me resolve it. I have built an application that supports
both English and Spanish text. When I compile, I get /bin/snafu.dll and
/bin/es-MX/snafu.resources.dll. When I run it on my workstation, everything
is fine; I can see both the English and Spanish versions. However, when I
copy the application to another machine, I can no longer see the...
|
by: Giampaolo Rodola' |
last post by:
I was reading os.readlink doc which says:
readlink( path)
Return a string representing the path to which the symbolic link
points. The result may be either an absolute or relative pathname; if
it is relative, it may be converted to an absolute pathname using
os.path.join(os.path.dirname(path), result). Availability: Macintosh,
Unix.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |