public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Conda Python script not getting right command line argument
@ 2023-07-03 22:12 ravi r
  2023-07-04  0:04 ` Brian Inglis
  0 siblings, 1 reply; 2+ messages in thread
From: ravi r @ 2023-07-03 22:12 UTC (permalink / raw)
  To: cygwin

Using

Cygwin Python interpreter invoked from shebang line
    $ cat /tmp/script1
    #!/usr/bin/python

    print("hello");
   $ /tmp/script1
    hello
    $
works as expected.


Conda Python interpreter invoked from shebang line
    $ cat /tmp/script2
    #!/usr/local/anaconda3/python

    print("hello");
    $ /tmp/script2
    C:\cygwin64\usr\local\anaconda3\python.exe: can't open file
'C:\\tmp\\script2':
    [Errno 2] No such file or directory
    $
fails to get the right path of the input file to execute. The correct
path that should been
passed to the Conda interpreter would have been
    c:\cygwin64\tmp\script2

Version of cygwin being used
    base-cygwin                                         3.8-2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Conda Python script not getting right command line argument
  2023-07-03 22:12 Conda Python script not getting right command line argument ravi r
@ 2023-07-04  0:04 ` Brian Inglis
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Inglis @ 2023-07-04  0:04 UTC (permalink / raw)
  To: cygwin; +Cc: ravi r

On 2023-07-03 16:12, ravi r via Cygwin wrote:
> Using
> Cygwin Python interpreter invoked from shebang line
>      $ cat /tmp/script1
>      #!/usr/bin/python
>      print("hello");
>     $ /tmp/script1
>      hello
>      $
> works as expected.
> Conda Python interpreter invoked from shebang line
>      $ cat /tmp/script2
>      #!/usr/local/anaconda3/python
>      print("hello");
>      $ /tmp/script2
>      C:\cygwin64\usr\local\anaconda3\python.exe: can't open file
> 'C:\\tmp\\script2':
>      [Errno 2] No such file or directory
>      $
> fails to get the right path of the input file to execute. The correct
> path that should been
> passed to the Conda interpreter would have been
>      c:\cygwin64\tmp\script2
> Version of cygwin being used
>      base-cygwin                                         3.8-2

Package base-cygwin has its own version and only helps setup the first install.

Cygwin version can be shown by running uname -a or head /proc/version.

Cygwin supports running scripts using Cygwin paths with Cygwin interpreters.
Cygwin executes Windows executables directly, and does not convert Cygwin paths 
into Windows paths: you have to set the paths up to make them correspond, or 
provide an appropriate argument for a Windows executable.

As Anaconda is a commercial Windows product, you have to change those python 
scripts to use Windows paths acceptable to that product, run from a Windows 
shell, using Windows Open with... file associations.
Anaconda product support can help you with setup and changes needed.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-04  0:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 22:12 Conda Python script not getting right command line argument ravi r
2023-07-04  0:04 ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).