[Answer]-Python:Errno 22 Invalid argument

1👍

How are you populating filepath? Most likely you are constructing it using Linux file path convention, Linux uses front-slash (/) as path separator whereas Windows uses back-slash (\). Use Python’s os.path module to formulate file paths in a platform independent manner.

#prints spam\egg on Windows and spam/egg on Linux
print os.path.join('spam', 'egg')

Leave a comment