开发者

using scp in a python script on opensolaris

开发者 https://www.devze.com 2023-01-18 11:08 出处:网络
I have written a python script to transfer files/folders between two machines. I have used scp for this and have included it as import scp

I have written a python script to transfer files/folders between two machines. I have used scp for this and have included it as import scp but it's giving me this error:

ImportError: No module named scp.

How can I fix 开发者_StackOverflow社区it?


I'm a bit confused... Did it ever work before?

It seems like you just want to write a python script that calls the scp command, not a module.

In which case, do the following:

  1. remove the import,
  2. and just execute a simple command from your python script.


It sounds like /path/to/scp.py is not in your ${PYTHONPATH} environment variable.You can either move scp.py to somewhere within ${PYTHONPATH} or augment ${PYTHONPATH} to include /path/to either in your operating system or using sys.path in Python.

See also How do I copy a file to a remote server in python using scp or ssh?


pip install scp 

Run the above command and then run the script again.

0

精彩评论

暂无评论...
验证码 换一张
取 消