A former work colleague created a script a long time ago which among other things calls a Python file, this one retrieves information from two CSV files and merges them into one.
This script works great, no worries, and I needed to make some changes to it, just a couple of .replaces
.
The execution goes very well on my computer, but it does not work on the one for whom I made these modifications, there is an error message in the CMD and not being very good at Python I block, I of course tried research and several modifications, without success, each time the result is that the final file is found empty instead of containing all the data.
Suddenly it is the .replace
which blocks, on my pc no worries, on his error and all words is not replaced.
My version of Python is 2.7.14 and his is 3.8.6, I guess the problem is there but I don't see what to change.
I tried this method without success: UnicodeEncodeError: 'charmap' codec can't encode characters
The Python file:
#coding:utf-8
import sys
file_name=sys.argv[1]
file=open(file_name,"r")
file = ''.join([i for i in file]) \
.replace("clôturée", "Clôturée").replace(",",".").replace("Entitées", "").replace("Tous", "")
output=open(sys.argv[1],"w")
output.writelines(file)
output.close()