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

push solution to 664 #672

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

BishopWolf
Copy link

@BishopWolf BishopWolf commented Jan 21, 2025

Possible solution to #664

@BishopWolf
Copy link
Author

@dsarrut @tbaudier I don't know why this change breaks the CI, it is not supposed to change anything for Windows or Linux.

The error is really strange.

@dsarrut
Copy link
Contributor

dsarrut commented Jan 21, 2025

are you sure the PR is based on the current master ? The lines
https://github.com/OpenGATE/opengate/blob/master/opengate/utility.py#L379
seems different

@@ -379,17 +379,16 @@ def read_mac_file_to_commands(filename):
# read a file located into the 'mac' folder of the source code
# return a list of commands
resource_package = __name__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at why CI fails and I think that resource_package = __name__ should become resource_package = __package__. After I tried that, I got another error though:

File "/home/gate/dev/.venv/lib/python3.12/site-packages/gatetools/gate_helpers.py", line 11, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

It is not really clear for me where this gate_helpers.py is coming from.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is very useful. I'll make the change tomorrow

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In gatetools/gate_helpers.py, the following

import pkg_resources
gtv = pkg_resources.get_distribution("gatetools").version

could be replaced by

import importlib.metadata
gtv = importlib.metadata.version("gatetools")

Thank you, ChatGPT :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsarrut I have pushed both changes

BishopWolf added a commit to BishopWolf/GateTools that referenced this pull request Jan 22, 2025
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

Successfully merging this pull request may close these issues.

3 participants