GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Exception when building xpath query · Issue #46 · tableau/document-api-python

Exception when building xpath query #46

New issue
Copy link
New issue
Copy link
Closed
Closed
Exception when building xpath query#46
Copy link
Assignees
graysonarts
Labels
bug

Description

@t8y8
t8y8
opened on Jun 30, 2016
Issue body actions

I managed to trigger this when downloading workbooks from alpo.

This was done against the HEAD of a local copy of #45

`Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/xml/etree/ElementPath.py", line 263, in iterfind
selector = _cache[cache_key]
KeyError: (".//metadata-record[@Class='column'][local-name='[Today's Date]']", None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "runner.py", line 30, in
fields = wb_model.datasources[0].fields
File "/Users/tdoyle/Documents/py/document-api-python/tableaudocumentapi/datasource.py", line 135, in fields
self._fields = self._get_all_fields()
File "/Users/tdoyle/Documents/py/document-api-python/tableaudocumentapi/datasource.py", line 141, in _get_all_fields
return collections.OrderedDict([(k, v) for k, v in column_objects])
File "/Users/tdoyle/Documents/py/document-api-python/tableaudocumentapi/datasource.py", line 141, in
return collections.OrderedDict([(k, v) for k, v in column_objects])
File "/Users/tdoyle/Documents/py/document-api-python/tableaudocumentapi/datasource.py", line 140, in
for xml in self._datasourceTree.findall('.//column'))
File "/Users/tdoyle/Documents/py/document-api-python/tableaudocumentapi/datasource.py", line 17, in _mapping_from_xml
metadata_record = root_xml.find(xpath)
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/xml/etree/ElementTree.py", line 649, in find
return self._root.find(path, namespaces)
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/xml/etree/ElementPath.py", line 298, in find
return next(iterfind(elem, path, namespaces), None)
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/xml/etree/ElementPath.py", line 277, in iterfind
selector.append(ops[token[0]](next, token))
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/xml/etree/ElementPath.py", line 233, in prepare_predicate
raise SyntaxError("invalid predicate")
SyntaxError: invalid predicate`

Activity

  1. t8y8 commented on Jun 30, 2016

    @t8y8
    t8y8
    on Jun 30, 2016
    ContributorAuthor
    More actions

    Looks like values can't have quotes for xpath in python.

    From the docs: Selects all elements for which the given attribute has the given value. The value cannot contain quotes.

    https://docs.python.org/3/library/xml.etree.elementtree.html#supported-xpath-syntax

  2. graysonarts commented on Jul 1, 2016

    @graysonarts
    graysonarts
    on Jul 1, 2016
    Contributor
    More actions

    Yup, I saw that when I was developing the xpath, but can't believe we don't encode the quote when writing out to the xml. I'll have to check for single quotes and revert to a more expensive search to get around this. I'll get this fixed in the morning. Can you send me the file where you ran into this? I'll turn it into a test case (after cleaning up any potential private information from it, of course)

  3. t8y8 commented on Jul 1, 2016

    @t8y8
    t8y8
    on Jul 1, 2016
    ContributorAuthor
    More actions

    I found the twb (I'll send it to you offline until we can scrub it)

    We do actually encode it: '[Today's Date]'

  4. graysonarts
    added
    bug
    on Jul 1, 2016
  5. graysonarts
    self-assigned this
    on Jul 1, 2016
  6. graysonarts commented on Jul 1, 2016

    @graysonarts
    graysonarts
    on Jul 1, 2016
    Contributor
    More actions

    hah when I looked at that, it didn't include the & code and I was like "How is that even possible?" Okay so I'll need to add encoding step specifically for 's

  7. graysonarts
    added a commit that references this issue on Jul 1, 2016

    Initial attempt at enabling reading the columns from the datasource (#45

    481f38c
  8. graysonarts
    closed this as completedon Jul 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @graysonarts
    graysonarts

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.