Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: encode() argument 1 must be string without null bytes, not unicode #12

Open
zopyx opened this issue Feb 1, 2011 · 8 comments

Comments

@zopyx
Copy link

zopyx commented Feb 1, 2011

Standard/bare Plone 4.0.3 buildout

Using latest funnelweb version (as of today) give me the following:

ajung@blackmoon:~/sandboxes/plone4> bin/funnelweb --crawler:url=file:///home/ajung/tmp/www.dahme-spreewald.de
Traceback (most recent call last):
  File "bin/funnelweb", line 115, in <module>
    funnelweb.runner.runner({'ploneupload': {'target': 'http://admin:123@localhost:8080/Plone'}, 'crawler': {'url': 'file:///home/ajung/tmp/www.dahme-spreewald.de'}})
  File "/home/ajung/.buildout/eggs/funnelweb-1.0b4-py2.6.egg/funnelweb/runner/__init__.py", line 89, in runner
    zcml.load_config('configure.zcml', funnelweb)
  File "/home/ajung/.buildout/eggs/Zope2-2.12.14-py2.6-linux-x86_64.egg/Products/Five/zcml.py", line 60, in load_config
    _context = xmlconfig.file(file, package, _context, execute=execute)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 647, in file
    include(context, name, package)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 546, in include
    processxmlfile(f, context)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 378, in processxmlfile
    parser.parse(src)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 349, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 357, in endElementNS
    self.context.end()
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 537, in end
    self.stack.pop().finish()
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 685, in finish
    actions = self.handler(context, **args)
  File "/home/ajung/.buildout/eggs/z3c.autoinclude-0.3.2-py2.6.egg/z3c/autoinclude/zcml.py", line 104, in includePluginsDirective
    includeZCMLGroup(_context, info, filename)
  File "/home/ajung/.buildout/eggs/z3c.autoinclude-0.3.2-py2.6.egg/z3c/autoinclude/zcml.py", line 30, in includeZCMLGroup
    include(_context, filename, includable_package)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 546, in include
    processxmlfile(f, context)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 378, in processxmlfile
    parser.parse(src)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 349, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 357, in endElementNS
    self.context.end()
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 537, in end
    self.stack.pop().finish()
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 684, in finish
    args = toargs(context, *self.argdata)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 1376, in toargs
    args[str(name)] = field.fromUnicode(s)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/fields.py", line 139, in fromUnicode
    value = self.context.resolve(name)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 180, in resolve
    mod = __import__(mname, *_import_chickens)
  File "/home/ajung/.buildout/eggs/transmogrify.webcrawler-1.0b4-py2.6.egg/transmogrify/webcrawler/webcrawler.py", line 319, in <module>
    from lxml import etree
  File "lxml.etree.pyx", line 89, in init lxml.etree (src/lxml/lxml.etree.c:141129)
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/home/ajung/.buildout/eggs/funnelweb-1.0b4-py2.6.egg/funnelweb/configure.zcml", line 10.4-10.44
    ZopeXMLConfigurationError: File "/home/ajung/.buildout/eggs/transmogrify.webcrawler-1.0b4-py2.6.egg/transmogrify/webcrawler/configure.zcml", line 12.4-13.46
    TypeError: encode() argument 1 must be string without null bytes, not unicode
ajung@blackmoon:~/sandboxes/plone4> strace -f -oout bin/funnelweb --crawler:url=file:///home/ajung/tmp/www.dahme-spreewald.de
grep dahme out
Traceback (most recent call last):
  File "bin/funnelweb", line 115, in <module>
    funnelweb.runner.runner({'ploneupload': {'target': 'http://admin:123@localhost:8080/Plone'}, 'crawler': {'url': 'file:///home/ajung/tmp/www.dahme-spreewald.de'}})
  File "/home/ajung/.buildout/eggs/funnelweb-1.0b4-py2.6.egg/funnelweb/runner/__init__.py", line 89, in runner
    zcml.load_config('configure.zcml', funnelweb)
  File "/home/ajung/.buildout/eggs/Zope2-2.12.14-py2.6-linux-x86_64.egg/Products/Five/zcml.py", line 60, in load_config
    _context = xmlconfig.file(file, package, _context, execute=execute)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 647, in file
    include(context, name, package)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 546, in include
    processxmlfile(f, context)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 378, in processxmlfile
    parser.parse(src)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 349, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 357, in endElementNS
    self.context.end()
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 537, in end
    self.stack.pop().finish()
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 685, in finish
    actions = self.handler(context, **args)
  File "/home/ajung/.buildout/eggs/z3c.autoinclude-0.3.2-py2.6.egg/z3c/autoinclude/zcml.py", line 104, in includePluginsDirective
    includeZCMLGroup(_context, info, filename)
  File "/home/ajung/.buildout/eggs/z3c.autoinclude-0.3.2-py2.6.egg/z3c/autoinclude/zcml.py", line 30, in includeZCMLGroup
    include(_context, filename, includable_package)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 546, in include
    processxmlfile(f, context)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 378, in processxmlfile
    parser.parse(src)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/opt/python-2.6.4/lib/python2.6/xml/sax/expatreader.py", line 349, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 357, in endElementNS
    self.context.end()
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 537, in end
    self.stack.pop().finish()
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 684, in finish
    args = toargs(context, *self.argdata)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 1376, in toargs
    args[str(name)] = field.fromUnicode(s)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/fields.py", line 139, in fromUnicode
    value = self.context.resolve(name)
  File "/home/ajung/.buildout/eggs/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 180, in resolve
    mod = __import__(mname, *_import_chickens)
  File "/home/ajung/.buildout/eggs/transmogrify.webcrawler-1.0b4-py2.6.egg/transmogrify/webcrawler/webcrawler.py", line 319, in <module>
    from lxml import etree
  File "lxml.etree.pyx", line 89, in init lxml.etree (src/lxml/lxml.etree.c:141129)
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/home/ajung/.buildout/eggs/funnelweb-1.0b4-py2.6.egg/funnelweb/configure.zcml", line 10.4-10.44
    ZopeXMLConfigurationError: File "/home/ajung/.buildout/eggs/transmogrify.webcrawler-1.0b4-py2.6.egg/transmogrify/webcrawler/configure.zcml", line 12.4-13.46
    TypeError: encode() argument 1 must be string without null bytes, not unicode
@djay
Copy link
Member

djay commented Feb 1, 2011

I don't understand that stacktrace at all. It seems to be a zcml error but I'm not sure. It's not reproducible here. Any ideas?

@zopyx
Copy link
Author

zopyx commented Feb 1, 2011

hm...works on a Debian 64-bit
fails on my OpenSuse 11.3 box :(

@djay
Copy link
Member

djay commented Feb 2, 2011

it's weird in that it's the import of lxml.etree is failing. Perhaps it's your lxml build that's not right?

@zopyx
Copy link
Author

zopyx commented Feb 2, 2011

I have doubt about the lxml claim. Running other sites using lxml on the same system without issues

@djay
Copy link
Member

djay commented Feb 2, 2011

yeah I'm just guessing.
What I don't get from the stack trace is where the "encode" function is being called and how it can be related to "from lxml import etree"

@zopyx
Copy link
Author

zopyx commented Feb 2, 2011

I agree that the traceback is confusing - I also could not find anything out - of course I checked with pdb...wild guess is that we see some kind of call stack corruption (shadowing the real issue). This often happens with C extensions going wild.

@AncientSwordRage
Copy link

Did this ever get resolved? I'm looking into a similar issue (FlightDataServices/Soapbox#20) elsewhere with the same symptoms.

@amitparashari
Copy link

I am also facing the same of issue.
I have written a sample script and trying to convert it into executable using cx_freeze module on centos 7 platform with following module versions

Python version is 2.7.10, cx_freeze version is 4.3.4, lxml is 3.5. I don think so it could be a version problem

Following is the error when i run the exe. If I run the sample script in python shell, its working fine.

Traceback (most recent call last):
File "/usr/local/python/2.7.10/lib/python2.7/site- packages/cx_Freeze/initscripts/Console.py", line 27, in
exec(code, m.dict)
File "test.py", line 6, in
File "ExtensionLoader_lxml_etree.py", line 22, in
File "ExtensionLoader_lxml_etree.py", line 14, in bootstrap
File "src/lxml/lxml.etree.pyx", line 169, in init lxml.etree (src/lxml/lxml.etree.c:229940)
TypeError: encode() argument 1 must be string without null bytes, not unicode

from cx_Freeze import setup, Executable
copyDependentFiles=True
silent = True
includes = ["lxml","lxml._elementpath","collections"]
path=[]
setup(
name = "foobar",
version = "0.5",
description = "foobar-Description",
options = {
"build_exe": {
"includes": includes , }
}
executables = [Executable("test.py")]
)`

Can anyone guide on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants