pyscripter / pyscripter

Pyscripter is a feature-rich but lightweight Python IDE
MIT License
976 stars 305 forks source link

remote ssh on windows server can't execute python #946

Open ThetaGHun opened 5 years ago

ThetaGHun commented 5 years ago

when I configured my remote connection to Win2016 server and trying to activate it this message comes up:

Failed to execute Python (“C:\Python2\python.exe) on the SSH server ReturnCode: 1 Output: ErrorOutput: File ’, line 1 import

SyntaxError EOL while scanning string literal

ThetaGHun commented 5 years ago

P.S.: with Linux server opening the SSH for debugging works, but not with Windows server OpenSSH installed.

ThetaGHun commented 5 years ago

I figured out what the issue is: in cPySSHDebugger.pas line 114 you use this

'''import sys,os,tempfile;print(sys.version[0]);print(os.sep);print(tempfile.gettempdir())'''

However, it should this I guess:

'"import sys,os,tempfile;print(sys.version[0]);print(os.sep);print(tempfile.gettempdir())"'

It has " (one double mark) instead of '' (double single marks).

Because then I did run: python -c 'import sys,os,tempfile;print(sys.version[0]);print(os.sep);print(tempfile.gettempdir())'

I got this back:

File "", line 1 'import ^ SyntaxError: EOL while scanning string literal

See, the same error !

But when I did run this way:

python -c "import sys,os,tempfile;print(sys.version[0]);print(os.sep);print(tempfile.gettempdir())"

It all worked as expected.

ThetaGHun commented 5 years ago

Finally, I did compile it and found a temporary solution (run a remote init.py file instead of using "python -c"). But that is only a temporary solution.

(FYI, I didn't worked in Delphi for almost 25 years.)

pyscripter commented 5 years ago

Thanks for the bug report. I will have a closer look. But SSHing to Windows machine did work here. Are you using a recent version of OpenSSH from https://github.com/PowerShell/Win32-OpenSSH/releases on both sides?

You may also try putty (see https://pyscripter.blogspot.com/2019/01/ssh-engines-using-putty.html). I know it is being used a lot with success.

ThetaGHun commented 5 years ago

I use Win64 version OpenSSH on Win server side and I have Putty on my notebook.

If you want it, I can grant you temporary access to my VPS. So, you can take a closer look. (I know how hard it would be to debug if you have an other config.)

pyscripter commented 5 years ago

But which version of ssh? e.g.

C:>ssh -V OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5