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

[Python2] Trying to export a non-unicode string causes an error #105

Closed
imaduro opened this issue Nov 14, 2018 · 2 comments
Closed

[Python2] Trying to export a non-unicode string causes an error #105

imaduro opened this issue Nov 14, 2018 · 2 comments

Comments

@imaduro
Copy link

imaduro commented Nov 14, 2018

Exporting a parsed model that contains non-unicode strings causes the following error on Python2

>>> my_string = "value + value2"
>>> parsed = example_meta.model_from_str(my_string)
>>> from textx.export import model_export
>>> model_export(parsed, "my_file.dot")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/textx/export.py", line 163, in model_export
    model_export_to_file(f, model, repo)
  File "/usr/local/lib/python2.7/site-packages/textx/export.py", line 267, in model_export_to_file
    _export(model)
  File "/usr/local/lib/python2.7/site-packages/textx/export.py", line 222, in _export
    _export(list_obj)
  File "/usr/local/lib/python2.7/site-packages/textx/export.py", line 195, in _export
    for attr_name, attr in obj_cls._tx_attrs.items():
AttributeError: type object 'str' has no attribute '_tx_attrs'
@igordejanovic
Copy link
Member

Related to #99
We should have a better error report if a user pass a non-unicode object to *_from_str.

igordejanovic added a commit that referenced this issue Nov 21, 2018
This should prevent problems with Python 2.
See:
#105
#99
#117
igordejanovic added a commit that referenced this issue Nov 21, 2018
This should prevent problems with Python 2.
See:
#105
#99
#117
@igordejanovic
Copy link
Member

As of #120 textX strictly requires unicode.

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

No branches or pull requests

2 participants