NoneType to unicode

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

    NoneType to unicode

    My program reads ID3 tags from MP3 files and enters them into a database.
    I have been testing it on a variety of MP3s, including ones with
    weird characters in the tags (such as norweigan black metal bands)
    When this happens it throws the program as they are outside the ascii
    range, the program crashes as soon as I try to bind the tag to a string
    using the str() function.

    I have tried using the encode() function to change the values to unicode
    however I cannot do this because they are returned from the id3
    library as "NoneType" instances. which means I need to convert
    to a string first (which i can't do because it crashes the application)

    Any ideas?
    cheers
  • Alan Franzoni

    #2
    Re: NoneType to unicode

    John Morey on comp.lang.pytho n said:
    [color=blue]
    > I have tried using the encode() function to change the values to unicode
    > however I cannot do this because they are returned from the id3
    > library as "NoneType" instances. which means I need to convert
    > to a string first (which i can't do because it crashes the application)[/color]

    NoneType is just the type of None. It should mean that your ID3 library
    returns 'None' when trying to read non-ascii ID3s. I think you should check
    your ID3 library, not your main program.

    --
    Alan Franzoni <alan.franzoni. xyz@gmail.com>
    -
    Togli .xyz dalla mia email per contattarmi.
    Rremove .xyz from my address in order to contact me.
    -
    GPG Key Fingerprint:
    5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E

    Comment

    Working...