tags:

views:

71

answers:

4

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?

+3  A: 

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.
haylem
+1  A: 

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?

Johnsyweb
A: 

no bt i just want to use that scp command in my script..

rushi
You can write comment under your question, or even better edit your question.
Michał Niklas
@rushi: follow the link I gave you in my answer and you should be fine.
haylem
A: 

can u tell me wat is wrong in this statement: os.system(scp [email protected]:/home/rushi/test.txt /export/home/rushi/abc.txt) thanks

rushi
You are missing quotation marks. However, this is a different question and not be posted as an **answer**.
Johnsyweb