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

Evaluation error when dataset has slash in name #66

Closed
byquip opened this issue Nov 16, 2021 · 4 comments
Closed

Evaluation error when dataset has slash in name #66

byquip opened this issue Nov 16, 2021 · 4 comments
Labels
fixed Fix for issue has been released.

Comments

@byquip
Copy link

byquip commented Nov 16, 2021

Hello, I was trying to retrieve some data from my .mph project but got error which I have no idea how to handle.
Is there way to fix it from my side?

import mph
client = mph.start(cores=1)
model = client.load("my_path")
sols = model.solutions()
dats = model.datasets()
print(sols)
print(dats)
for dat in dats:
    print(dat)
    s = model.outer(dat)
    print(s)

OUTPUT:

Traceback (most recent call last):
  File "C:/Users/n/Desktop/d/comsoltest.py", line 10, in <module>
    s = model.outer(dat)
  File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\mph\model.py", line 407, in outer
    if not dataset.exists():
  File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\mph\node.py", line 278, in exists
    return (self.java is not None)
  File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\mph\node.py", line 212, in java
    return eval(self.groups.get(name))
TypeError: eval() arg 1 must be a string, bytes or code object
['Solution 1', 'Parametric Solutions 1', 'wl=1.15E-6']
['Study 1//Solution 1', 'Study 1//Parametric Solutions 1']
Study 1//Solution 1

Process finished with exit code 1
@byquip
Copy link
Author

byquip commented Nov 16, 2021

removing slash "//" solved this problem.

@byquip byquip closed this as completed Nov 16, 2021
@john-hen
Copy link
Collaborator

You know, this may actually be a bug. But I've only briefly looked at your traceback and you've already closed the issue. I may give this a second look some other time.

@wakass
Copy link

wakass commented Jan 4, 2022

Having the same issue, removing the slash from the dataset name inside COMSOL is a workaround. Would be great if this could be fixed. Slashes seem to be standard when parametrizing a study.

Windows 10, COMSOL 5.6 btw.

@john-hen john-hen reopened this Jan 4, 2022
@john-hen john-hen added the bug Something isn't working. label Jan 4, 2022
@john-hen john-hen changed the title Error during retrieving data Evaluation error when dataset has slash in name Jan 4, 2022
john-hen added a commit that referenced this issue Jan 6, 2022
Essentially this is fixed by no longer supporting named data-set
references with strings like `'datasets/electrostatic'`, i.e.,
where the `datasets` group is explicitly named instead of just
the actual data set. In retrospect, this notation strikes me as
strange and I don't know why I added support for that. Let's hope
nobody has been using it. By ignoring that special case, the
forward slash is handled by the escaping mechanism in the `Node`
class, which then works as expected.
@john-hen
Copy link
Collaborator

john-hen commented Jan 8, 2022

Fixed in version 1.1.2, released today.

@john-hen john-hen closed this as completed Jan 8, 2022
@john-hen john-hen added fixed Fix for issue has been released. and removed bug Something isn't working. labels Jan 8, 2022
john-hen added a commit that referenced this issue Feb 21, 2022
Animations can now be exported via `Model.export()`, just like images
and data files. The animation type is deduced from the file ending
as either a GIF, Flash, AVI, or WebM encoded movie, or a PNG image
sequence. This covers all animation types supported by Comsol 5.6.

Much like in #66, we no longer allow specifying nodes via a string
such as `'export/image'`. This was never documented anyway and may lead
to problems with node names that actually contain a forward slash
(which would be escaped as `//`). The node must be given as either a
string such as `'image'` or a reference like `model/'exports'/'image'`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Fix for issue has been released.
Projects
None yet
Development

No branches or pull requests

3 participants