Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Josep

    Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

    I'm playing with an application framework (or kinda) that's developed
    with python, and it throws this error:

    File "/usr/lib/python2.5/site-packages/Dabo-0.8.3-py2.5.egg/dabo/db/dCursorMixin.py ", line 281, in execute
    sql = unicode(sql, self.Encoding)
    LookupError: unknown encoding: utf_8_euro
    At the application (DABO) mailing list, they have pointed that this has
    to be a Python issue. As I'm a totally python newbie, I would ask if
    somebody has experimented this kind of error, and if there is any known
    solution. I've found no clue searching at Google right now.

    My Python version is 2.5.2, Ubuntu Hardy .deb package.

    Thanks in advance for your help.

    --

    Josep Sànchez
    [papapep]
    ----------------------------------

    ----------------------------------

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (GNU/Linux)

    iD8DBQBIP/IZsQfW0y2pjQkRA rbaAKCS06qFLqSp CTOIjdprcXz6twx VaACeLSxF
    1X1WBK442eY7+z9 1BeGAmYk=
    =7rkf
    -----END PGP SIGNATURE-----

  • Sanoski

    #2
    Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

    On May 30, 8:24 am, Josep <papa...@gmail. comwrote:
    I'm playing with an application framework (or kinda) that's developed
    with python, and it throws this error:
    >
    File "/usr/lib/python2.5/site-packages/Dabo-0.8.3-py2.5.egg/dabo/db/dCursorMixin.py ", line 281, in execute
        sql = unicode(sql, self.Encoding)
    LookupError: unknown encoding: utf_8_euro
    >
    At the application (DABO) mailing list, they have pointed that this has
    to be a Python issue. As I'm a totally python newbie, I would ask if
    somebody has experimented this kind of error, and if there is any known
    solution. I've found no clue searching at Google right now.
    I've had nothing but problems ever since I upgraded to Hardy. I used
    to be a die hard Ubuntu fan until recently. Maybe try a better OS
    >
    My Python version is 2.5.2, Ubuntu Hardy .deb package.
    >
    Thanks in advance for your help.
    >
    --
    >
    Josep Sànchez
    [papapep]
    ----------------------------------http://extralinux.net
    ----------------------------------
    >
     signature.asc
    1KDownload

    Comment

    • Peter Otten

      #3
      Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

      Josep wrote:
      I'm playing with an application framework (or kinda) that's developed
      with python, and it throws this error:
      >
      >
      >File
      >"/usr/lib/python2.5/site-packages/Dabo-0.8.3-py2.5.egg/dabo/db/dCursorMixin.py ",
      >line 281, in execute
      > sql = unicode(sql, self.Encoding)
      >LookupError: unknown encoding: utf_8_euro
      >
      At the application (DABO) mailing list, they have pointed that this has
      to be a Python issue. As I'm a totally python newbie, I would ask if
      somebody has experimented this kind of error, and if there is any known
      solution. I've found no clue searching at Google right now.
      >
      My Python version is 2.5.2, Ubuntu Hardy .deb package.
      Python might get confused by an @EURO suffix in the locale:

      $ LANG=de_DE.UTF-8@EURO
      $ python -c"import locale; print locale.getdefau ltlocale()"
      ('de_DE', 'utf_8_euro')

      Try setting the LANG environment variable to something like

      $ LANG=de_DE.UTF-8
      $ python -c"import locale; print locale.getdefau ltlocale()"
      ('de_DE', 'UTF8')

      before you run your program (use ca_ES or whatever you need instead of
      de_DE).

      Peter

      Comment

      • =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=

        #4
        Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

        >File "/usr/lib/python2.5/site-packages/Dabo-0.8.3-py2.5.egg/dabo/db/dCursorMixin.py ", line 281, in execute
        > sql = unicode(sql, self.Encoding)
        >LookupError: unknown encoding: utf_8_euro
        >
        At the application (DABO) mailing list, they have pointed that this has
        to be a Python issue.
        It's definitely not a Python issue.
        As I'm a totally python newbie, I would ask if
        somebody has experimented this kind of error, and if there is any known
        solution. I've found no clue searching at Google right now.
        The problem is that self.Encoding is incorrect - it should not be
        utf_8_euro. Instead, it should be UTF-8 (or perhaps utf_8). DABO
        shouldn't use locale.getdefau ltlocale()[1], but
        locale.getprefe rredencoding().

        Regards,
        Martin

        Comment

        • Peter Otten

          #5
          Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

          "Martin v. Löwis" wrote:
          >>File
          >>"/usr/lib/python2.5/site-packages/Dabo-0.8.3-py2.5.egg/dabo/db/dCursorMixin.py ",
          >>line 281, in execute
          >> sql = unicode(sql, self.Encoding)
          >>LookupError : unknown encoding: utf_8_euro
          >>
          >At the application (DABO) mailing list, they have pointed that this has
          >to be a Python issue.
          >
          It's definitely not a Python issue.
          >
          >As I'm a totally python newbie, I would ask if
          >somebody has experimented this kind of error, and if there is any known
          >solution. I've found no clue searching at Google right now.
          >
          The problem is that self.Encoding is incorrect - it should not be
          utf_8_euro. Instead, it should be UTF-8 (or perhaps utf_8). DABO
          shouldn't use locale.getdefau ltlocale()[1], but
          locale.getprefe rredencoding().
          I think that is the effect of a bug:
          >>locale._parse _localename("en _US.UTF-8@euro")
          ('en_US', 'utf_8_euro')

          The function first normalizes the "@" away and then looks for it. Is that
          the expected behaviour?

          Peter

          Comment

          • M.-A. Lemburg

            #6
            Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

            On 2008-05-30 17:41, Peter Otten wrote:
            Josep wrote:
            >
            >I'm playing with an application framework (or kinda) that's developed
            >with python, and it throws this error:
            >>
            >>
            >>File
            >>"/usr/lib/python2.5/site-packages/Dabo-0.8.3-py2.5.egg/dabo/db/dCursorMixin.py ",
            >>line 281, in execute
            >> sql = unicode(sql, self.Encoding)
            >>LookupError : unknown encoding: utf_8_euro
            >At the application (DABO) mailing list, they have pointed that this has
            >to be a Python issue. As I'm a totally python newbie, I would ask if
            >somebody has experimented this kind of error, and if there is any known
            >solution. I've found no clue searching at Google right now.
            >>
            >My Python version is 2.5.2, Ubuntu Hardy .deb package.
            >
            Python might get confused by an @EURO suffix in the locale:
            Right, that's what's happening.

            The locale module uses a locale aliasing table that help map environment
            locale settings to C local names.

            That table was last updated in 2004 and since then a lot more
            locale variable strings have made their way into the Linux
            distros.

            I guess we need to update the table...
            $ LANG=de_DE.UTF-8@EURO
            $ python -c"import locale; print locale.getdefau ltlocale()"
            ('de_DE', 'utf_8_euro')
            >
            Try setting the LANG environment variable to something like
            >
            $ LANG=de_DE.UTF-8
            $ python -c"import locale; print locale.getdefau ltlocale()"
            ('de_DE', 'UTF8')
            >
            before you run your program (use ca_ES or whatever you need instead of
            de_DE).
            >
            Peter
            --
            http://mail.python.org/mailman/listinfo/python-list
            --
            Marc-Andre Lemburg
            eGenix.com

            Professional Python Services directly from the Source (#1, May 30 2008)
            >>Python/Zope Consulting and Support ... http://www.egenix.com/
            >>mxODBC.Zope.D atabase.Adapter ... http://zope.egenix.com/
            >>mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
            _______________ _______________ _______________ _______________ ____________

            :::: Try mxODBC.Zope.DA for Windows,Linux,S olaris,MacOSX for free ! ::::


            eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
            D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
            Registered at Amtsgericht Duesseldorf: HRB 46611

            Comment

            • M.-A. Lemburg

              #7
              Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

              On 2008-05-30 22:37, M.-A. Lemburg wrote:
              On 2008-05-30 17:41, Peter Otten wrote:
              >Josep wrote:
              >>
              >>I'm playing with an application framework (or kinda) that's developed
              >>with python, and it throws this error:
              >>>
              >>>
              >>>File
              >>>"/usr/lib/python2.5/site-packages/Dabo-0.8.3-py2.5.egg/dabo/db/dCursorMixin.py ",
              >>>>
              >>>line 281, in execute
              >>> sql = unicode(sql, self.Encoding)
              >>>LookupErro r: unknown encoding: utf_8_euro
              >>At the application (DABO) mailing list, they have pointed that this has
              >>to be a Python issue. As I'm a totally python newbie, I would ask if
              >>somebody has experimented this kind of error, and if there is any known
              >>solution. I've found no clue searching at Google right now.
              >>>
              >>My Python version is 2.5.2, Ubuntu Hardy .deb package.
              >>
              >Python might get confused by an @EURO suffix in the locale:
              >
              Right, that's what's happening.
              >
              The locale module uses a locale aliasing table that help map environment
              locale settings to C local names.
              >
              That table was last updated in 2004 and since then a lot more
              locale variable strings have made their way into the Linux
              distros.
              >
              I guess we need to update the table...
              I've opened ticket http://bugs.python.org/issue3011 for this.
              >$ LANG=de_DE.UTF-8@EURO
              >$ python -c"import locale; print locale.getdefau ltlocale()"
              >('de_DE', 'utf_8_euro')
              >>
              >Try setting the LANG environment variable to something like
              >>
              >$ LANG=de_DE.UTF-8
              >$ python -c"import locale; print locale.getdefau ltlocale()"
              >('de_DE', 'UTF8')
              >>
              >before you run your program (use ca_ES or whatever you need instead of
              >de_DE).
              >>
              >Peter
              >--
              >http://mail.python.org/mailman/listinfo/python-list
              >
              --
              Marc-Andre Lemburg
              eGenix.com

              Professional Python Services directly from the Source (#1, May 30 2008)
              >>Python/Zope Consulting and Support ... http://www.egenix.com/
              >>mxODBC.Zope.D atabase.Adapter ... http://zope.egenix.com/
              >>mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
              _______________ _______________ _______________ _______________ ____________

              :::: Try mxODBC.Zope.DA for Windows,Linux,S olaris,MacOSX for free ! ::::


              eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
              D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
              Registered at Amtsgericht Duesseldorf: HRB 46611

              Comment

              • =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=

                #8
                Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

                The function first normalizes the "@" away and then looks for it. Is that
                the expected behaviour?
                I believe this functionality is broken by design. Python can't possibly
                know correctly what each locale name on each system means, and what
                encoding is used in the locale.

                Instead, the system's API to find out the encoding should be used,
                as exposed in locale.getprefe rredencoding().

                Regards,
                Martin

                Comment

                • Jan Claeys

                  #9
                  Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

                  Op Fri, 30 May 2008 22:37:14 +0200, schreef M.-A. Lemburg:
                  On 2008-05-30 17:41, Peter Otten wrote:
                  >Josep wrote:
                  >>My Python version is 2.5.2, Ubuntu Hardy .deb package.
                  >Python might get confused by an @EURO suffix in the locale:
                  Right, that's what's happening.
                  >
                  The locale module uses a locale aliasing table that help map environment
                  locale settings to C local names.
                  >
                  That table was last updated in 2004 and since then a lot more locale
                  variable strings have made their way into the Linux distros.
                  >
                  I guess we need to update the table...
                  Ubuntu doesn't use @EURO suffixes...?

                  $ grep EURO /usr/share/i18n/SUPPORTED
                  $


                  --
                  JanC

                  Comment

                  Working...