cygwin python.exe symlink breaks when called from .bat file

Discussion in 'Python' started by gry@ll.mit.edu, Dec 15, 2004.

  1. Guest

    [Windows XP Pro, cygwin python 2.4]

    Under cygwin, the python executable is installed as python2.4.exe with
    a
    symbolic link to python.exe. This is fine as long as one is operating
    only
    withing the cygwin world. But I execute python from a foo.bat file,
    and
    windows barfs on the symbolic link. I replaced it with a hard link and
    all
    is well. Is there some reason this shouldn't be the standard
    installation
    under cygwin?
     
    , Dec 15, 2004
    #1
    1. Advertising

  2. On Wed, Dec 15, 2004 at 07:21:31AM -0800, gry wrote:
    > Under cygwin, the python executable is installed as python2.4.exe with
    > a symbolic link to python.exe. This is fine as long as one is
    > operating only withing the cygwin world. But I execute python from a
    > foo.bat file, and windows barfs on the symbolic link.


    You can always do the following as a workaround:

    C:\> bash -c python

    > I replaced it with a hard link and all is well.


    Note the above will only work as a true hard link under NTFS. IMO, the
    above is a better approach.

    > Is there some reason this shouldn't be the standard installation under
    > cygwin?


    Because it would require (more) modification of the Unix build to
    accommodate Windows. IMO, it is not worth the effort. If you feel
    differently, then submit a patch for consideration:

    http://sf.net/tracker/?func=add&group_id=5470&atid=305470

    BTW, many other Cygwin commands have this issue too:

    $ find /bin -type l -name '*.exe'
    /bin/awk.exe
    /bin/c++.exe
    /bin/captoinfo.exe
    /bin/cc.exe
    ...

    Jason

    --
    PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
    Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6
     
    Jason Tishler, Dec 15, 2004
    #2
    1. Advertising

  3. George,

    Please keep your replies on-list.

    On Wed, Dec 15, 2004 at 01:36:03PM -0500, george young wrote:
    > On Wed, 15 Dec 2004 10:56:17 -0500
    > Jason Tishler <> threw this fish to the penguins:
    > > On Wed, Dec 15, 2004 at 07:21:31AM -0800, gry wrote:
    > > > Under cygwin, the python executable is installed as python2.4.exe
    > > > with a symbolic link to python.exe. This is fine as long as one
    > > > is operating only withing the cygwin world. But I execute python
    > > > from a foo.bat file, and windows barfs on the symbolic link.

    > >
    > > You can always do the following as a workaround:
    > >
    > > C:\> bash -c python

    >
    > Hmm, that's fine for typing a command interactively, but try fitting
    > it into a DOS "ftype" command so that double-clicking a .py file gets
    > the right thing with the right args -- nasty, I couldn't get it to
    > work.


    Since you are looking for tight integration with Windows, maybe you
    should use Win32 Python?

    > > > I replaced it with a hard link and all is well.

    > >
    > > Note the above will only work as a true hard link under NTFS. IMO,
    > > the above is a better approach.
    > >
    > > > Is there some reason this shouldn't be the standard installation
    > > > under cygwin?

    > >
    > > Because it would require (more) modification of the Unix build to
    > > accommodate Windows. IMO, it is not worth the effort. If you feel
    > > differently, then submit a patch for consideration:
    > >
    > > http://sf.net/tracker/?func=add&group_id=5470&atid=305470

    >
    > I'll try that... maybe I can light a fire.
    >
    > > BTW, many other Cygwin commands have this issue too:
    > >
    > > $ find /bin -type l -name '*.exe'
    > > /bin/awk.exe
    > > /bin/c++.exe
    > > /bin/captoinfo.exe
    > > /bin/cc.exe
    > > ...


    Jason

    --
    PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
    Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6
     
    Jason Tishler, Dec 16, 2004
    #3
  4. Jason Tishler wrote:

    >> > You can always do the following as a workaround:
    >> >
    >> > C:\> bash -c python

    >>
    >> Hmm, that's fine for typing a command interactively, but try fitting
    >> it into a DOS "ftype" command so that double-clicking a .py file gets
    >> the right thing with the right args -- nasty, I couldn't get it to
    >> work.

    >
    > Since you are looking for tight integration with Windows, maybe you
    > should use Win32 Python?


    I don't use Cygwin myself, but several Cygwin users have told me that
    exemaker has been immensely useful for them:

    http://effbot.org/zone/exemaker.htm

    </F>
     
    Fredrik Lundh, Dec 16, 2004
    #4
  5. wrote:
    > [Windows XP Pro, cygwin python 2.4]
    >
    > Under cygwin, the python executable is installed as python2.4.exe with
    > a
    > symbolic link to python.exe. This is fine as long as one is operating
    > only
    > withing the cygwin world. But I execute python from a foo.bat file,
    > and
    > windows barfs on the symbolic link. I replaced it with a hard link and
    > all


    You could rename the symbolic link python.exe to python. Bash finds it
    anyway and cmd.exe will it ignore it. Several of the symbolic links are
    created without .exe by the installation.

    If you really want to use cygwin-Python from cmd.exe, use doskey to
    create an alias or create a batch file.

    > is well. Is there some reason this shouldn't be the standard
    > installation
    > under cygwin?


    Hard links are available only with NTFS volumes. (OK, you could create a
    hard link with FAT*, but chkdsk will complain.)

    Daniel
     
    Daniel Dittmar, Dec 16, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    534
  2. mastar
    Replies:
    5
    Views:
    153
  3. Marc Heiler
    Replies:
    4
    Views:
    284
    Robert Klemme
    Jun 10, 2009
  4. HoneyMonster
    Replies:
    9
    Views:
    445
    John Roth
    Feb 24, 2012
  5. Tom Salzmann
    Replies:
    3
    Views:
    262
Loading...

Share This Page