0

Hi all,
in a python script file, I am having a open statement and then i write a "50000" to that file. And then within the script i am writing a scp command that transfers the file to a remote machine. In the local machine if i check the file I can see the value that was written by the script. But on the remote machine if i open the file then i see the value 0.

Why is this? Why cant i see the value that I had written/

Regards,
Prashanth

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by prashanth s j
0

You need to flush the buffer of the opened file before you try to transfer it. Or else you are accidentally transferring an empty file of the same name (but different path). I had that happen to me one time. Took a long time to find it because you don't think to look for that problem.

Edited by griswolf: n/a

0

Hi,
I initially had thought it might be due to flush issue. But dint what is the flush command in Python, so just tried "print" to see whether it will flush the data in file to the disk But it dint work.(If you could tell me what is the flush equivalent on Python it would be great.) It was showing the size of the file transferred as zero on the remote machine. The error was, "Write error in swap file". Apparently it was due to disk space overused. I found that there were some really very huge files on the root. I promptly deleted all of them. And after that file size was properly displayed as 5 on the remote machine.

Regards,
Prashanth

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.