I am running into the following error when attempting to perform separate operations for Opening files in another program, closing files in another program and performing system operations such as copy file on a unicode based file name. My current code works fine on a Macintosh but not on Windows. I just started working with unicode file names and the CLI.
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0301' in position 5: ordinal not in range(128)
A simplified close file in another application example goes something like this:
def CloseFile( fileToClose ):
cmd = [ 'sudo', fmsadmin, 'close', fileToClose, '-u', 'userName', '-p', 'accountName', '-y' ]
subprocess.check_output( cmd )
CloseFile( u'ÉürøFile.fmp12' )
I have tried performing a decode before the set of the cmd variable but that is not working.
fileToClose = fileToClose.decode('utf-8')
I can give you an CopyFile() example if you want but this with error out well before the command is called. So you shouldn't need FileMaker Server installed to reproduce the issue.
I'm using shutil.copy( from, to ) for the copy method.