executing a pyz file thru SSH fails with invalid syntax. Why?

373 views Asked by At

I want to execute a pyz file over SSH in this way:

cat test.pyz | ssh -M user@somehost python

The current output is this:

  File "<stdin>", line 1
    PKimport sys
      ^
SyntaxError: invalid syntax

The host/endpoint is a Windows machine.

I created the pyz file, from command line, in this way:

python -m zipapp test/

Here is a link to the pyz file.

The content of the test folder is

├── test
│   ├── __main__.py
│   ├── executor.py

main.py

#!/usr/bin/env python3
import sys
import executor

if __name__ == '__main__':
    executor.execute(sys.argv)

executor.py

#!/usr/bin/env python3

def execute(args):
    print("hello world")
  • If I execute the pyz file locally, it works.
  • If I copy the pyz file to the Windows machine and run "python test.pyz", it works as expected too.

    Any ideas what's happening?, how to solve it?

0

There are 0 answers