[ python-Bugs-928297 ] platform.libc_ver() fails on Cygwin

SourceForge.net noreply at sourceforge.net
Fri Apr 2 23:20:51 EST 2004


Bugs item #928297, was opened at 2004-04-02 23:55
Message generated for change (Comment added) made by quiver
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=928297&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: George Yoshida (quiver)
Assigned to: M.-A. Lemburg (lemburg)
Summary: platform.libc_ver() fails on Cygwin

Initial Comment:
>>> import platform
>>> platform.libc_ver()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/platform.py", line 134, in libc_ver
    f = open(executable,&#039;rb&#039;)
IOError: [Errno 2] No such file or 
directory: &#039;/usr/bin/python&#039;

The problem is that on Cygwin sys.executable 
returns /path/to/python, but since Cygwin is running on 
Windows, sys.executable is a symbolic link 
to /path/to/python.exe.

>>> import os, sys
>>> os.path.exists(sys.executable)
True
>>> os.path.isfile(sys.executable)
True
>>> file(sys.executable)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 2] No such file or 
directory: &#039;/usr/bin/python&#039;
>>> os.path.islink(sys.executable)
True
>>> os.path.realpath(sys.executable)
&#039;/usr/bin/python2.3.exe&#039;
>>> file(sys.executable + &#039;.exe&#039;)
<open file &#039;/usr/bin/python.exe&#039;, mode &#039;r&#039; at 0xa100ca0>

Following is the info about the machine I tested:

>>> from platform import *
>>> platform()
&#039;CYGWIN_NT-5.0-1.5.7-0.109-3-2-i686-32bit&#039;
>>> python_compiler()
&#039;GCC 3.3.1 (cygming special)&#039;
>>> python_build()
(1, &#039;Dec 30 2003 08:29:25&#039;)
>>> python_version()
&#039;2.3.3&#039;
>>> uname()
(&#039;CYGWIN_NT-5.0&#039;, &#039;my_user_name&#039;, &#039;1.5.7
(0.109/3/2)&#039;, &#039;2004-01-30 19:32&#039;, &#039;i686&#039;, &#039;&#039;)


----------------------------------------------------------------------

>Comment By: George Yoshida (quiver)
Date: 2004-04-03 13:20

Message:
Logged In: YES 
user_id=671362

First, I need to correct my previous post. 'symbolic' was 
unrelated.
Python on Cygwin does't like exe files that doesn't end 
with '.exe'.
I think changing fileobject.c to support I/O exe files on 
Cygwin whether it ends with '.exe' or not is the way to go.

Is there anyone who can do that? It's beyoond my skill level.

$ ls -l /usr/bin/python*
lrwxrwxrwx  1 abel  Users    24 Jan  1 01:34 /usr/bin/python -
> python2.3.exe
lrwxrwxrwx  1 abel  Users    24 Jan  1 
01:34 /usr/bin/python.exe -> python2.3.exe
-rwxrwxrwx  1 abel  Users  4608 Dec 30 
22:32 /usr/bin/python2.3.exe

>>> file('/usr/bin/python')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 2] No such file or directory: '/usr/bin/python'
>>> file('/usr/bin/python.exe')
<open file '/usr/bin/python.exe', mode 'r' at 0xa069320>
>>> file('/usr/bin/python2.3')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 2] No such file or 
directory: '/usr/bin/python2.3'
>>> file('/usr/bin/python2.3.exe')
<open file '/usr/bin/python2.3.exe', mode 'r' at 0xa0c8de0>

----------------------------------------------------------------------

Comment By: M.-A. Lemburg (lemburg)
Date: 2004-04-03 00:59

Message:
Logged In: YES 
user_id=38388

Patches are welcome :-)

I don't have cygwin installed, so there's nothing much
I can do about this.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=928297&group_id=5470



More information about the Python-bugs-list mailing list