Ticket #270 (assigned defect)

Opened 15 months ago

Last modified 15 months ago

apt unicode error

Reported by: alexbruy Owned by: maphew
Priority: major Component: Package
Version: Keywords: apt unicode
Cc:

Description

Just installed apt via OSGeo4W installer under Windows XP. When I try to run it from OSGeo4W Shell I get error

Traceback (most recent call last):
  File "<string>", line 991, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position 36-42: ordinal not in range(128)

My system is Windows XP Pro SP3, all packages downloaded with OSGeo4W installer and stored in D:\install\gis\osgeo4w\offline\. Working installation is C:\OSGeo4W

Attachments

apt.diff Download (5.0 KB) - added by jef 15 months ago.
the attached patch fixes the problem for me

Change History

Changed 15 months ago by jef

Does your account name have non-ascii characters in it?

Changed 15 months ago by alexbruy

No, only ASCII.

Changed 15 months ago by maphew

  • owner changed from osgeo4w-dev@… to maphew
  • status changed from new to assigned
  • summary changed from apt don't work under Windows XP to apt unicode error on Windows XP

Apt doesn't know anything about unicode yet.

What is your Start Menu path?

Line 991 of apt.py attempts to create the environment variable OSGEO4W_STARTMENU, which in turn is derived from the system ALLUSERSPROGRAMS special folder -- this is C:\ProgramData\Microsoft\Windows\Start Menu on a us-english win7 computer and C:\Documents and Settings\All Users\Start Menu\Programs on us-english winXP.

Changed 15 months ago by alexbruy

Seems this is root of the problem. In non-english (in my case Russian/Ukrainian?) Windows XP Start Menu path contains non-ASCII characters C:\Documents and Settings\All Users\Главное меню\Программы

Changed 15 months ago by maphew

  • keywords unicode added
  • summary changed from apt unicode error on Windows XP to apt unicode error

I did some research on how to handle unicode in python and everything I found is way over my head. I'm afraid apt will have to classified as working on ansi systems only for the time being. (patches to change this gratefully accepted).

A workaround would be to edit bin\apt-dev.py and change:

## insert at line 2:
# coding: utf-8
## line 991 from:
OSGEO4W_STARTMENU = get_special_folder(ALLUSERSPROGRAMS) + "\\" + start_menu_name
# to:
OSGEO4W_STARTMENU = r'C:\Documents and Settings\All Users\Главное меню\Программы'
# or to skip menu links altogether:
OSGEO4W_STARTMENU = os.getenv('TEMP')

(and then run apt-dev instead of apt of course.)

Changed 15 months ago by jef

the attached patch fixes the problem for me

Note: See TracTickets for help on using tickets.