Use 8-bit bytestrings in image_cache.py

Bug #315247 reported by Marco Rodrigues
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Entertainer Media Center
Fix Committed
High
Francesco Marella

Bug Description

Exception in thread IndexerThread:
Traceback (most recent call last):
  File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.5/site-packages/entertainerlib/backend/components/mediacache/indexer_thread.py", line 68, in run
    cache.addDirectory(element)
  File "/usr/lib/python2.5/site-packages/entertainerlib/backend/components/mediacache/image_cache.py", line 135, in addDirectory
    if not self.isDirectoryInCache(root):
  File "/usr/lib/python2.5/site-packages/entertainerlib/backend/components/mediacache/image_cache.py", line 201, in isDirectoryInCache
    WHERE path=:p""", { "p" : path})
ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings

Related branches

Paul Hummer (rockstar)
Changed in entertainer:
assignee: nobody → rockstar
importance: Undecided → High
status: New → Triaged
Revision history for this message
Marco Rodrigues (gothicx) wrote :

I can also confirm it.

Revision history for this message
Matt Layman (mblayman) wrote : Re: [Bug 315247] Re: Use 8-bit bytestrings in image_cache.py

On Sun, Mar 22, 2009 at 7:17 PM, Marco Rodrigues <email address hidden> wrote:

> I can also confirm it.
>
> --
> Use 8-bit bytestrings in image_cache.py
> https://bugs.launchpad.net/bugs/315247
> You received this bug notification because you are a member of
> Entertainer Developers, which is subscribed to Entertainer Media Center.
>

Marco, fyi, there's really no reason for you to confirm this. You were the
one who reported the bug so it is a foregone conclusion that you would claim
to confirm it. Confirmation is something more useful when a third party can
independently confirm a bug. Of course, there are exceptions to this rule,
for example, I confirmed some of my own bugs when I turned on new pylint
flags, but that would be verifiable by anyone.

Revision history for this message
Marco Rodrigues (gothicx) wrote :

Oops.. that was my fault. you're right.. I though I see another person as the reporter. lol..

Changed in entertainer:
assignee: Paul Hummer (rockstar) → Samuel Buffet (samuel-buffet)
Changed in entertainer:
status: Triaged → In Progress
Changed in entertainer:
assignee: Samuel Buffet (samuel-buffet) → nobody
status: In Progress → Triaged
Revision history for this message
Junnior Sesshou (sesshu) wrote :

I had the same problem:

No kernel support for execution fencing, disabling texture tiling
Entertainer backend starting...
Exception in thread IndexerThread:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
    self.run()
  File "/home/junnior/Desktop/entertainer/entertainerlib/backend/components/mediacache/indexer_thread.py", line 65, in run
    cache.addDirectory(element)
  File "/home/junnior/Desktop/entertainer/entertainerlib/backend/components/mediacache/music_cache.py", line 126, in addDirectory
    self.addFile(os.path.join(root, name))
  File "/home/junnior/Desktop/entertainer/entertainerlib/backend/components/mediacache/music_cache.py", line 63, in addFile
    if (not self.isFileInCache(filename) and
  File "/home/junnior/Desktop/entertainer/entertainerlib/backend/components/mediacache/music_cache.py", line 191, in isFileInCache
    WHERE filename=:fn""", {"fn":filename} )
ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

Revision history for this message
Paul Hummer (rockstar) wrote :

Junior, could you tell me the exact name of the file, with the special characters and all? I'll write a test case for the new indexer to make sure it works properly.

Revision history for this message
Junnior Sesshou (sesshu) wrote :

It appear when the shell run entertainer.py

Revision history for this message
Junnior Sesshou (sesshu) wrote :

When I try to convert to UTF-8 with Kate this warning appears:

No kernel support for execution fencing, disabling texture tiling
Entertainer backend starting...
Exception in thread IndexerThread:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
    self.run()
  File "/home/junnior/Desktop/entertainer/entertainerlib/backend/components/mediacache/indexer_thread.py", line 65, in run
    cache.addDirectory(element)
  File "/home/junnior/Desktop/entertainer/entertainerlib/backend/components/mediacache/music_cache.py", line 126, in addDirectory
    self.addFile(os.path.join(root, name))
  File "/home/junnior/Desktop/entertainer/entertainerlib/backend/components/mediacache/music_cache.py", line 63, in addFile
    if (not self.isFileInCache(filename) and
  File "/home/junnior/Desktop/entertainer/entertainerlib/backend/components/mediacache/music_cache.py", line 191, in isFileInCache
    WHERE filename=:fn""", {"fn":filename} )
ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

Traceback (most recent call last):
  File "./entertainer", line 13, in <module>
    main()
  File "/home/junnior/Desktop/entertainer/entertainerlib/frontend/__init__.py", line 34, in main
    frontend_client = FrontendClient()
  File "/home/junnior/Desktop/entertainer/entertainerlib/frontend/frontend_client.py", line 43, in __init__
    self.quit_frontend)
  File "/home/junnior/Desktop/entertainer/entertainerlib/frontend/gui/user_interface.py", line 106, in __init__
    self.volume_indicator = VolumeIndicator()
  File "/home/junnior/Desktop/entertainer/entertainerlib/frontend/gui/widgets/volume_indicator.py", line 20, in __init__
    filled = clutter.Texture(theme.getImage("volume_filled"))
  File "/home/junnior/Desktop/entertainer/entertainerlib/utils/theme.py", line 155, in getImage
    raise Exception("No image available for given element.")
Exception: No image available for given element.

Revision history for this message
Junnior Sesshou (sesshu) wrote :

P.S. I have Python 2.6

Changed in entertainer:
assignee: nobody → Francesco Marella (francesco-marella)
Revision history for this message
Frank Krick (frank-krick) wrote :

I have the same problem. The error about the unicode strings is thrown in the isDirectoryInCache(self, path) method of the ImageCache class.

entertainerlib/backend/components/mediacache/image_cache.py

I have added a print statement at the beginning of the function, printing the content of the path variable. The function is called without problems until the file name is "Königreich der Himmel" which contains the german umlaut ö. Python prints the filename as "Königreich der Himmel". So the problem seems to be due to non-ascii characters in the path.

Matt Layman (mblayman)
Changed in entertainer:
milestone: none → entertainer-0.6
Matt Layman (mblayman)
Changed in entertainer:
status: Triaged → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.