Conda Python script not getting right command line argument

Brian Inglis Brian.Inglis@Shaw.ca
Tue Jul 4 00:04:37 GMT 2023


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


More information about the Cygwin mailing list