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

Reading multiple components does not work #13

Open
zegervdv opened this issue Jul 11, 2018 · 3 comments
Open

Reading multiple components does not work #13

zegervdv opened this issue Jul 11, 2018 · 3 comments

Comments

@zegervdv
Copy link
Contributor

When reading in 2 components in the same python instance, the second one is incomplete:

In [1]: f1 = open('file1.xml', 'r')
In [2]: f2 = open('file2.xml', 'r')
In [3]: from ipyxact.ipyxact import Component
In [4]: c1 = Component()
In [5]: c2 = Component()
In [6]: c1.load(f1)
In [7]: c2.load(f2)
In [8]: c1.memoryMaps
Out[8]: <ipyxact.ipyxact.MemoryMaps at 0x2ffa290>
In [9]: c1.memoryMaps.memoryMap
Out[9]:
[<ipyxact.ipyxact.MemoryMap at 0x3085dd0>,
 <ipyxact.ipyxact.MemoryMap at 0x30870d0>]

In [10]: c2.memoryMaps

In [11]: c2.memoryMaps.memoryMap
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-4b0e797fcc70> in <module>()
----> 1 c2.memoryMaps.memoryMap

AttributeError: 'NoneType' object has no attribute 'memoryMap'

I need to start a new python interpreter and load everything again to be able to read the second file correctly.

I tried by deleting the references to c1 and by unloading/reloading the module but only a fresh python interpreter will make it work again.

Changing the order of the opening, instance creation or loading does not make a difference.

@olofk
Copy link
Owner

olofk commented Apr 9, 2019

Ouch. That doesn't sound nice. I'm probably doing some questionable things here. Don't have a good idea for now, but the long-term solution will be to move to another API that is created by generateDS. There's some preliminary work here

@zegervdv
Copy link
Contributor Author

For now I'm working around it by using a ProcessPoolExecutor and running each import in a separate process.

@olofk
Copy link
Owner

olofk commented Mar 22, 2022

From version 0.3.0 and onwards, a new API will be used which hopefully doesn't have this problem. You can find the new API here and I will push some example code later on

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