0

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 it?

1
  • import is for importing other python modules, not running external commands. Commented Oct 4, 2010 at 9:50

3 Answers 3

3

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.
Sign up to request clarification or add additional context in comments.

Comments

1

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?

Comments

1
pip install scp 

Run the above command and then run the script again.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.