Fwd: Problem deleting tree

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fwd: Problem deleting tree

Paul Franklin-5
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.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fwd: Problem deleting tree

Paul Franklin-5
This is somewhat old but since (I believe) no fix has yet
been committed, I'd still appreciate your comments.

Especially if you run on Windows (maybe only non-English?).

Thanks.

---------- Forwarded message ----------
From: Paul Franklin <[hidden email]>
Date: Thu, 23 Mar 2017 13:52:34 -0700
Subject: Fwd: Problem deleting tree
To: [hidden email]
Cc: [hidden email]

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.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fwd: Problem deleting tree

Josip
18.6.2017. u 20:08, Paul Franklin je napisao/la:

> This is somewhat old but since (I believe) no fix has yet
> been committed, I'd still appreciate your comments.
>
> Especially if you run on Windows (maybe only non-English?).
>
> Thanks.
>
> ---------- Forwarded message ----------
> From: Paul Franklin <[hidden email]>
> Date: Thu, 23 Mar 2017 13:52:34 -0700
> Subject: Fwd: Problem deleting tree
> To: [hidden email]
> Cc: [hidden email]
>
> 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.
>

You are right that adding "encoding='utf-8'" will fix that for Windows
users. Does not matter in which language gramps is run on Windows if you
name your family tree with name which contains characters who is outside
of your code page then you will get this crash when try to delete them
from family tree manager.

Both version are same in old version file is closed by "close()", in new
version is closed by context manager. Both will not leak file descriptors!

IMHO use last version, commit it to gramps50 then it will later be
merged in master, cherry-pick to maintenance/gramps42

--
Josip

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fwd: Problem deleting tree

Paul Franklin-5
On 6/18/17, Josip <[hidden email]> wrote:

> 18.6.2017. u 20:08, Paul Franklin je napisao/la:
>> This is somewhat old but since (I believe) no fix has yet
>> been committed, I'd still appreciate your comments.
>>
>> Especially if you run on Windows (maybe only non-English?).
>>
>> Thanks.
>>
>> ---------- Forwarded message ----------
>> From: Paul Franklin <[hidden email]>
>> Date: Thu, 23 Mar 2017 13:52:34 -0700
>> Subject: Fwd: Problem deleting tree
>> To: [hidden email]
>> Cc: [hidden email]
>>
>> 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.
>>
>
> You are right that adding "encoding='utf-8'" will fix that for Windows
> users. Does not matter in which language gramps is run on Windows if you
> name your family tree with name which contains characters who is outside
> of your code page then you will get this crash when try to delete them
> from family tree manager.
>
> Both version are same in old version file is closed by "close()", in new
> version is closed by context manager. Both will not leak file descriptors!
>
> IMHO use last version, commit it to gramps50 then it will later be
> merged in master, cherry-pick to maintenance/gramps42
>

Thank you.  I'll do that, probably after filing a bug about it.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Loading...