Giter Site home page Giter Site logo

pylgnetcast's Issues

Traceback error in etree - unknown encoding

Thanks for the code and work on this! I'm working to use more of the API function - calling pylgnetcast.py from another script. So for testing, just using the example from your site.

I get this error and after a lot of Googling, cannot figure it out.

Traceback (most recent call last):
  File "./checktv.py", line 12, in <module>
    print(ElementTree.tostring(data[0], encoding='unicode'))
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1126, in tostring
    ElementTree(element).write(file, encoding, method=method)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 817, in write
    self._root, encoding, default_namespace
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 884, in _namespaces
    add_qname(tag)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 868, in add_qname
    qnames[qname] = encode(qname)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 843, in encode
    return text.encode(encoding)
LookupError: unknown encoding: unicode

if i change the print statement to this, it dumps all of the xml directly:
print(ElementTree.tostring(data[0], encoding='utf-8'))

Resulting in this:

<data><mute>false</mute><minLevel>0</minLevel><maxLevel>100</maxLevel><level>29</level></data>

What is the desired output? I assume just "29"? I just want to ensure proper parsing before I get to much farther along.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.