Paul Franklin
2017-03-23 20:52:34 UTC
A Greek user recently posted this on gramps-users.
132898: ERROR: grampsapp.py: line 140: Unhandled exception
Traceback (most recent call last):
File "C:\Program
Files\GrampsAIO64-4.2.4\lib\python3.5\site-packages\gramps\gui\dbman.py",
line 552, in __remove_db
self.__really_delete_db, parent=self.top)
File "C:\Program
Files\GrampsAIO64-4.2.4\lib\python3.5\site-packages\gramps\gui\dialog.py",
line 110, in __init__
task()
File "C:\Program
Files\GrampsAIO64-4.2.4\lib\python3.5\site-packages\gramps\gui\dbman.py",
line 584, in __really_delete_db
file_name_to_delete=name_file.read()
File "C:\Program
Files\GrampsAIO64-4.2.4\lib\python3.5\encodings\cp1253.py", line 23,
in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9c in position
1: character maps to <undefined>
My guess is that it would be solved by changing gui/dbman.py
from:
try:
name_file = open(filename, "r")
file_name_to_delete=name_file.read()
name_file.close()
to:
try:
name_file = open(filename, "r", encoding='utf-8')
file_name_to_delete=name_file.read()
name_file.close()
But master has:
try:
with open(filename, "r") as name_file:
file_name_to_delete = name_file.read()
remove_filename(file_name_to_delete)
so should I change the gramps42 lines to be like master,
and make them both be:
try:
with open(filename, "r", encoding='utf-8') as name_file:
file_name_to_delete = name_file.read()
remove_filename(file_name_to_delete)
Thanks.
132898: ERROR: grampsapp.py: line 140: Unhandled exception
Traceback (most recent call last):
File "C:\Program
Files\GrampsAIO64-4.2.4\lib\python3.5\site-packages\gramps\gui\dbman.py",
line 552, in __remove_db
self.__really_delete_db, parent=self.top)
File "C:\Program
Files\GrampsAIO64-4.2.4\lib\python3.5\site-packages\gramps\gui\dialog.py",
line 110, in __init__
task()
File "C:\Program
Files\GrampsAIO64-4.2.4\lib\python3.5\site-packages\gramps\gui\dbman.py",
line 584, in __really_delete_db
file_name_to_delete=name_file.read()
File "C:\Program
Files\GrampsAIO64-4.2.4\lib\python3.5\encodings\cp1253.py", line 23,
in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9c in position
1: character maps to <undefined>
My guess is that it would be solved by changing gui/dbman.py
from:
try:
name_file = open(filename, "r")
file_name_to_delete=name_file.read()
name_file.close()
to:
try:
name_file = open(filename, "r", encoding='utf-8')
file_name_to_delete=name_file.read()
name_file.close()
But master has:
try:
with open(filename, "r") as name_file:
file_name_to_delete = name_file.read()
remove_filename(file_name_to_delete)
so should I change the gramps42 lines to be like master,
and make them both be:
try:
with open(filename, "r", encoding='utf-8') as name_file:
file_name_to_delete = name_file.read()
remove_filename(file_name_to_delete)
Thanks.