Code Monkey home page Code Monkey logo

Comments (6)

toastdriven avatar toastdriven commented on July 19, 2024

Bizarre. No clue what's going wrong here, since etree has no problems serializing integers. Using pdb to inspect the message (pysolr.py, line 686 from the traceback) would probably be informative.

from pysolr.

wichert avatar wichert commented on July 19, 2024

pdb under mod_wsgi in production isn't really an option I'm afraid, and I haven't been able to reproduce this in a test environment.

from pysolr.

toastdriven avatar toastdriven commented on July 19, 2024

Then perhaps setting up a try/except block that catches the error & logs what was sent? You might also try installing lxml, as it looks like you're falling back on Python's etree, which sometimes has subtle differences from lxml.etree.

from pysolr.

tleach avatar tleach commented on July 19, 2024

We just hit this. Can pysolr not simply do the type conversion of the commitWithin arg from int -> str?

Happy to contribute a PR if so desired.

from pysolr.

acdha avatar acdha commented on July 19, 2024

This is an annoying limitation in etree:

>>> from xml.etree.ElementTree import Element, ElementTree
>>> import sys
>>> ElementTree(Element(42)).write(sys.stdout)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 812, in write
    self._root, encoding, default_namespace
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 881, in _namespaces
    _raise_serialization_error(tag)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1047, in _raise_serialization_error
    "cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize 42 (type int)

Since ElementTree is [arguably] braindead I'd vote for a pull request adding an str() call on pysolr.py#L689 and, ideally, a test exercising this path.

from pysolr.

stale avatar stale commented on July 19, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from pysolr.

Related Issues (20)

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.