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

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.