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

Getting ValueError when trying to parse a file path with env var inside <spirit> tags #26

Open
tpoikela opened this issue Jun 10, 2021 · 2 comments

Comments

@tpoikela
Copy link

I ran into an issue like this:

Traceback (most recent call last):
  File "uvmf/my_script.py", line 15, in <module>
    ipxact_reader = IpxactReader(ipxact_file)
  File "/userwork11/tpoikela/git/uvmf/uvmf_tb_gen/uvmf_tb_gen.py", line 107, in __init__
    ipxact_comp.load(f)
  File "/userwork11/tpoikela/git/uvmf/.venv/lib/python3.8/site-packages/ipyxact/ipyxact.py", line 108, in load
    self.parse_tree(root, self.nsmap[self.nsversion])
  File "/userwork11/tpoikela/git/uvmf/.venv/lib/python3.8/site-packages/ipyxact/ipyxact.py", line 144, in parse_tree
    t.parse_tree(f, ns)
  File "/userwork11/tpoikela/git/uvmf/.venv/lib/python3.8/site-packages/ipyxact/ipyxact.py", line 135, in parse_tree
    t.parse_tree(f, ns)
  File "/userwork11/tpoikela/git/uvmf/.venv/lib/python3.8/site-packages/ipyxact/ipyxact.py", line 123, in parse_tree
    setattr(self, _name, eval(_type)(tmp.text))
  File "/userwork11/tpoikela/git/uvmf/.venv/lib/python3.8/site-packages/ipyxact/ipyxact.py", line 62, in __new__
    return int(expr.replace('_', ''), base)
ValueError: invalid literal for int() with base 10: '${MODULESPATH}/module/doc/moduleprogmodel.xlsx'

In the IP-XACT file, I see that it has specified some filepaths like this:

<spirit:parameter>
            <spirit:name>imported_from</spirit:name>
            <spirit:value>${MODULES_PATH}/module/doc/module_prog_model.xlsx</spirit:value>
</spirit:parameter>

Expected result: The parser does not throw ValueError, and parses the structure and filepath with env var correctly. No env var expansion/substitution is expected.

@olofk
Copy link
Owner

olofk commented Dec 14, 2023

I see you have a fix in your tree tpoikela@b1d6108 Does that fix this issue?

@tpoikela
Copy link
Author

tpoikela commented Mar 6, 2024

Yes, this should fix the issue.

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

2 participants