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

map typesystem on python does not work #33

Closed
gwenchee opened this issue Sep 7, 2018 · 5 comments
Closed

map typesystem on python does not work #33

gwenchee opened this issue Sep 7, 2018 · 5 comments
Assignees

Comments

@gwenchee
Copy link
Collaborator

gwenchee commented Sep 7, 2018

I am testing the a simple map typesystem for no_inst.py. An error is thrown when running a cyclus simulation.
State variable declaration in no_inst.py
test_out = ts.MapIntString( )

XML schema:
<test_out> <item> <key>3</key><val>POWER</val> </item> </test_out>

Cyclus output error:
AttributeError: 'list' object has no attribute 'encode' Exception ignored in: 'cyclus.typesystem.str_py_to_cpp' AttributeError: 'list' object has no attribute 'encode' XPath error : Invalid expression terminate called after throwing an instance of 'xmlpp::exception' what(): Invalid XPath: Aborted (core dumped)

@gwenchee gwenchee added the bug label Sep 7, 2018
@gwenchee gwenchee changed the title map typesystem map typesystem on python does not work Sep 12, 2018
jbae11 pushed a commit that referenced this issue Oct 12, 2018
@gwenchee gwenchee added this to the Complete DO Implementation milestone Nov 20, 2018
gwenchee pushed a commit that referenced this issue Dec 5, 2018
@gwenchee
Copy link
Collaborator Author

I tried using a default value for the mapintstring in timeseries_inst
Example:
contract = ts.MapIntString( doc="The contract quantity and recipe", tooltip="Contract quantity and recipe", uilabel="Contract", default = {0,"helllo"} )

This throws the same error as before:
AttributeError: 'list' object has no attribute 'encode' Exception ignored in: 'cyclus.typesystem.str_py_to_cpp' AttributeError: 'list' object has no attribute 'encode' XPath error : Invalid expression terminate called after throwing an instance of 'xmlpp::exception' what(): Invalid XPath:

@gwenchee
Copy link
Collaborator Author

@FlanFlanagan @jbae11

@gwenchee
Copy link
Collaborator Author

The issue is in gentypesystem.py that generates typesystem.pyx in the std_string str_py_to_cpp function. An object list is being passed through it for map types. However, it is hard to pinpoint where the function is called and where the list object is passing to it

@gwenchee
Copy link
Collaborator Author

gwenchee commented Apr 5, 2019

closed with #213

@gwenchee gwenchee closed this as completed Apr 5, 2019
@gwenchee
Copy link
Collaborator Author

gwenchee commented Apr 5, 2019

more explanation: #212

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

3 participants