Good afternoon everyone,
I am attempting to troubleshoot a python script I have not written myself, but which I have been tasked with fixing. The script takes files from some map document, zips them, and then transfers them using the synchronize function defined in a text document. The relevant bit of the code for WinSCP is below:
[b]Python Script (only the important part)[/b]
from subprocess import Popen
import os
#root = os.path.abspath(os.path.curdir)
root = r"{absolute path to directory in networked drive}"
print root
bat = '"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="{absolute path in networked drive to text file holding unix commands}" /log="{absolute path to log file in networked drive}"'
def upload_sftp(BAT,DIR):
p = Popen(BAT, cwd=DIR)
stdout, stderr = p.communicate()
if p.returncode == 0:
print("\n Transfer was Successful")
else:
print("\n Transfer was unsuccessful.\n Look up this return code for more details --> " + str(p.returncode) )
upload_sftp(bat, root)
[b]Unix Commands in text file[/b]
option batch abort
option confirm on
open {insert sftp link and hostkey here}
synchronize remote local_absolute_path_to_networked_drive_dir /HOME/OPEN_DATA
exit
So, the aforementioned script and the above commands work just fine when the workflow is restricted to the C: drive (exporting my files to a location in the C: drive, zipping in the C: drive, synchronizing from C: drive), but I have been asked to get it functioning on one of our network drives. Changing the absolute paths to locations in this network drive yields a "1" error code which seems to be an EOF error. I have been unable to produce log files in either the C or networked drive. I apologize for not being able to provide this.
Apologies if I am not doing an adequate job describing the workflow, I am still reading through the software documentation and learning myself. Please request any additional information and I will do my best to supply it. Thank you