Git Product home page Git Product logo

xml2xlsx's People

Contributors

marrog avatar pkaczynski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

xml2xlsx's Issues

Uni Code input

ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

Contact

Hi team,

I've tried to contact you in mail but there was no response, can you please contact me ?

[email protected]

Thanks,

TypeError is raised when cell with date type is empty

  • XML2XLSX version: 1.0.1
  • Python interpreter version: 3.7.3
  • Platform: Darwin-18.6.0-x86_64-i386-64bit

Assume that there is a cell with type attribute set to date, which has no value. During the conversion, TypeError gets thrown by the strptime() function, as the value of passed argument self._cell.value is None, rather than a string, which is expected.

Here is the traceback:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 615, in run
    testMethod()
  File "/Users/exer2k/code/xml2xlsx/tests/__init__.py", line 169, in test_cell_type_date
    sheet = io.BytesIO(xml2xlsx(template))
  File "/Users/exer2k/code/xml2xlsx/xml2xlsx/__init__.py", line 237, in xml2xlsx
    return etree.XML(xml, parser, )
  File "src/lxml/etree.pyx", line 3213, in lxml.etree.XML
  File "src/lxml/parser.pxi", line 1876, in lxml.etree._parseMemoryDocument
  File "src/lxml/parser.pxi", line 1757, in lxml.etree._parseDoc
  File "src/lxml/parser.pxi", line 1068, in lxml.etree._BaseParser._parseUnicodeDoc
  File "src/lxml/parsertarget.pxi", line 192, in lxml.etree._TargetParserContext._handleParseResultDoc
  File "src/lxml/parsertarget.pxi", line 180, in lxml.etree._TargetParserContext._handleParseResultDoc
  File "src/lxml/etree.pyx", line 318, in lxml.etree._ExceptionContext._raise_if_stored
  File "src/lxml/saxparser.pxi", line 485, in lxml.etree._handleSaxEnd
  File "src/lxml/parsertarget.pxi", line 99, in lxml.etree._PythonSaxParserTarget._handleSaxEnd
  File "/Users/exer2k/code/xml2xlsx/xml2xlsx/__init__.py", line 216, in end
    self._cell.value, self._cell_date_format).date()
TypeError: strptime() argument 1 must be str, not None

This can be asserted with the following unit test:

import unittest
from xml2xlsx import xml2xlsx

class CellTest(unittest.TestCase):
    def test_empty_cell_type_date(self):
        template = """
        <sheet title="test">
            <row><cell type="date" date-fmt="%d.%m.%Y"></cell></row>
        </sheet>
        """
        self.assertRaises(TypeError, xml2xlsx, template)

Instead, the script should catch this, leave the cell empty, and continue with the execution. It is a simple fix, and I can provide a pull request if you accept them.

HELP!: lxml.etree.XMLSyntaxError: Start tag expected, '<' not found, line 1, column 1 error

Hi,

i am trying to use your script to convert a standard XML file to XLSX file. I am new to python and i am getting the error lxml.etree.XMLSyntaxError: Start tag expected, '<' not found, line 1, column 1.

With a simple script such as

from xml2xlsx import xml2xlsx

def ConvertXmlToXlsx(self):
    xml2xlsx("C:\Python27\PythonExcel\\test.xml")

I am not sure how to input my xml file in your function.

thanks

Olivier

Contact

Hi team,

I've tried to contact you in mail but there was no response, can you please contact me ?

[email protected]

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.