From: Benny M. <ben...@gm...> - 2008-02-08 22:20:52
|
Isaac, your username on windows is indeed the problem. The error GRAMPS throws up is: UnicodeDecodeError: 'utf8' codec can't decode bytes in position 33-35: invalid data and position 33-35 is exactly the accent in your name. It looks like the code to open a database environment will have to take into account filesystem encoding. Can you file a bug at our bug tracker with the information that is in this mail, you find it at http://bugs.gramps-project.org/my_view_page.php As a workaround so you can use GRAMPS: look for the file const.py in the install dir of gramps. You find the code piece in it: # # Determine the home directory. According to Wikipedia, most UNIX like # systems use HOME. I'm assuming that this would apply to OS X as well. # Windows apparently uses USERPROFILE # #------------------------------------------------------------------------- if os.environ.has_key('USERPROFILE'): user_home = os.environ['USERPROFILE'] home_dir = os.path.join(user_home,'gramps') else: user_home = os.environ['HOME'] home_dir = os.path.join(user_home,'.gramps') And change this so user_home is a directory that has no strange accents. Eg: # # Determine the home directory. According to Wikipedia, most UNIX like # systems use HOME. I'm assuming that this would apply to OS X as well. # Windows apparently uses USERPROFILE # #------------------------------------------------------------------------- if os.environ.has_key('USERPROFILE'): user_home = 'C:\Documents and Settings' home_dir = os.path.join(user_home,'gramps') else: user_home = os.environ['HOME'] home_dir = os.path.join(user_home,'.gramps') That should allow you to save grdb files. Note that once you did the above change, any previously existing grdb can no longer be opened. Grdb is not a portable format, it is tied to the environment directory. Export to .gramps regularly to obtain backups. Benny 2008/2/8, Isaac Sánchez Barrera <isa...@te...>: > > Benny, > This is the Windows XP output: > > Python 2.5.1 <r251:54863, Apr 18 2007, 08:51:08> [MSC v.1310 32 bit > <Intel>] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> print sys.getfilesystemencoding() > mbcs > >>> import os > >>> user_home = os.environ['USERPROFILE'] > >>> home_dir = os.path.join(user_home,'gramps') > >>> env_dir = os.path.join(home_dir,"env" > >>> print env_dir > C:\Documents and Settings\Isaac Sβnchez\gramps\env > >>> newfilename = 'myfilename' > >>> drive, tmp_name = os.path.splitdrive(newfilename) > >>> tmp_name = tmp_name.lstrip(os.sep) > >>> print tmp_name > myfilename > >>> env_name = os.path.join(os.path.expanduser(env_dir), tmp_name) > >>> print env_name > C:\Documents and Settings\Isaac Sβnchez\gramps\env\myfilename > >>> > > Maybe the problem is there because my username has got accents, but there > aren't any errors when saving on .gramps or .ged (and, as I told you on my > last message, I save the genealogical data in a file without accents nor > spaces on its name and path). > > I've tried GRAMPS on my Ubuntu again and it saves in ".grdb" correctly, so > I haven't tested the commands on it. If you need me to run those commands on > my Ubuntu, just tell me and I will. > > Isaac > > > > Benny Malengier wrote: > > Jim, you think this is an encoding problem? > > Isaac, > > First, this code is changed for upcoming 3.0 version, so there it should > not happen. > Please test if it is a problem for linux too, this is an os specific piece > of code. > > Could you test some commands in python? > Just start a python session in windows, then: > > python > Python 2.5.1 (r251:54863, May 2 2007, 16:27:44) > [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 --> in your case this > should be win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> print sys.getfilesystemencoding() > >>> import os > >>> user_home = os.environ['USERPROFILE'] > >>> home_dir = os.path.join(user_home,'gramps') > >>> env_dir = os.path.join(home_dir,"env") > >>> print env_dir > >>> newfilename = '_WRITE_HERE_THE_FILENAME ' > >>> drive, tmp_name = os.path.splitdrive(newfilename) > >>> tmp_name = tmp_name.lstrip(os.sep) > >>> print tmp_name > >>> env_name = os.path.join(os.path.expanduser(env_dir), tmp_name) > >>> print env_name > > GRAMPS crashes on that second to last line, so the crash is in a python > module. > I would like to have the output you obtain from the print statements > above. Can you paste them here? > Now, the general problem is that if you write here a filename, it is in > the encoding of how you type strings, however, in GRAMPS, the filename comes > from a filechooser dialog, so it is given in the encoding of the filesystem. > > Benny > > PS, in linux it is user_home = os.environ['HOME'], and the join is with > .gramps, not gramps > > 2008/2/7, Isaac Sánchez Barrera <isa...@te...>: > > > > When I save in GRAMPS XML format or GEDCOM, it saves correctly. If I try > > to save the file in a ".grdb" format, I get the error I told you on the last > > message. > > I'm currently using English filenames without spaces (of the format > > x:\foldername\treefilename.ged OR x:\foldername\treefilename.gramps) and, if > > I'm not wrong, the GEDCOM (and the GRAMPS file) are using the UTF-8 charset, > > but there are surnames and individuals with Spanish characters. > > > > OS: Windows XP Professional [Win32 5.1] > > > > I've also got a Ubuntu-Studio installation and I think the same problem > > appears when trying to export to a .grdb file. > > > > Thanks for your fast answer, > > > > Isaac > > > > PS: I've just signed up on the Windows list with my gmail account. > > > > > > Benny Malengier wrote: > > > > Isaac, this looks like a windows bug with the name of a database. > > > > Is it correct you did a Save As, and gave a name with eg spanish > > characters? Could you give the name you gave? > > > > It should work if you limit yourself to english language characters, but > > we would be interested to know what is not working on Windows. Could you > > give the Windows version too, and if possible, what charset you work with? I > > don't use windows so unfortunately I cannot tell you where to find that > > info, but we have a gramps windows mailing list ( > > http://www.gramps-project.org/wiki/index.php?title=Contact&grampsd_wiki_session=1ac7cb6147a0c92333b0f1cd4112ff65) > > where you can ask that. > > > > Benny > > > > PS: export to .gramps format regularly on Windows > > > > 2008/2/7, Isaac Sánchez Barrera <isa...@te...>: > > > > > > User Information: > > > =================== > > > > > > I was saving on grdb > > > > > > > > > Error Details: > > > =================== > > > > > > 35655: ERROR: dbloader.py: line 488: Failed to open database. > > > Traceback (most recent call last): > > > File "C:\Archivos de programa\gramps\DbLoader.py", line 485, in > > > open_saved_as > > > self.uistate.pulse_progressbar) > > > File "C:\Archivos de programa\gramps\GrampsDb\_GrampsBSDDB.py", line > > > 465, in load_from > > > self.load(filename,callback) > > > File "C:\Archivos de programa\gramps\GrampsDb\_GrampsBSDDB.py", line > > > 354, in load > > > tmp_name) > > > File "C:\Python25\lib\ntpath.py", line 102, in join > > > path += "\\" + b > > > UnicodeDecodeError: 'utf8' codec can't decode bytes in position 33-35: > > > invalid data > > > > > > System Information: > > > =================== > > > > > > Python version: 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.131032 bit (Intel)] > > > BSDDB version: 4.4.5.2 > > > Gramps version: 2.2.10-1 > > > LANG: es > > > OS: win32 > > > Distribution: > > > > > > > > > > > > ------------------------------------------------------------------------- > > > This SF.net email is sponsored by: Microsoft > > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > _______________________________________________ > > > Gramps-bugs mailing list > > > Gra...@li... > > > https://lists.sourceforge.net/lists/listinfo/gramps-bugs > > > > > > > > > |