I have a problem with this snippet of code:
import optparse
parser = optparse.OptionParser(version=__version__,
usage="%prog [options] file1 ... host[:dest]",
description=main.__doc__)
parser.add_option("-c", "--config", help="Specify an alternate config "
"file. Default = '%s'" % config_file)
parser.add_option('-l', '--log-level', type="choice",
choices=LOG_LEVELS.keys(),
help="Override the default logging level. Choices=%s, Default=%s" %
(",".join(LOG_LEVELS.keys()), LOG_LEVEL))
parser.add_option("-o", "--overwrite", action="store_true",
help="If specified, overwrite existing files at destination. If "
"not specified, throw an exception if you try to overwrite a file")
parser.add_option('-s', "--speed", action="store_true", \
help="If specifed, print the data transfer rate for each file "
"that is uploaded (infers verbose option)")
parser.add_option('-v', '--verbose', action="store_true",
help="If specified, print every file that is being uploaded and every "
"directory that is being created")
parser.add_option("-u", "--user", help="The username to use for "
"authentication. Not needed if you have set up a config file.")
parser.add_option("-p", "--password", help="The password to use for "
"authentication. Not needed if you have set up a config file.")
parser.set_defaults(config=config_file, log_level=LOG_LEVEL)
options, args = parser.parse_args()
print (args)
As you can see, when I print the args of a test we are doing with hebrew named file, the print result includes: ['/root/mezeo_sdk/1/\xfa\xe5\xeb\xf0\xe9\xfa \xf2\xe1\xe5\xe3\xe4.xlsx', 'hostname'] Instead of /root/mezeo_sdk/1/"תוכנית עבודה.xlsx"
Also, the end result once the script uploads the file to the server (the way the filename was passed) is: https://i.stack.imgur.com/JC1rt.png
The filename itself is good on the linux source, because if I SCP it to my own computer it looks ok, but not once I transfer it to the file server using the python script.
I also dont believe the problem is on the file server side, because if I use the web interface to upload hebrew named files, they are OK.
I think the problem is with the usage of optparse library.