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

Use module.__path__[0] instead of module.__file__ #2769

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

njzjz
Copy link
Member

@njzjz njzjz commented Aug 29, 2023

Fix #2751.

If __init__.py does not exist, module.__file__ is None (it is expected to give the path to __init__.py). In this case, module.__path__[0] will give the directory path.

Fix deepmodeling#2751.

If `__init__.py` does not exist, `module.__file__` is `None` (it is expected to give the path to `__init__.py`). In this case, `module.__path__[0]` will give the directory path.

It's unclear why there is an empty directory without `__init__.py` in deepmodeling#2751.

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
@njzjz njzjz linked an issue Aug 29, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01% ⚠️

Comparison is base (f97b4f2) 78.72% compared to head (66ce950) 78.71%.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #2769      +/-   ##
==========================================
- Coverage   78.72%   78.71%   -0.01%     
==========================================
  Files         241      241              
  Lines       25610    25610              
  Branches     1517     1517              
==========================================
- Hits        20162    20160       -2     
  Misses       5058     5058              
- Partials      390      392       +2     
Files Changed Coverage Δ
deepmd/env.py 68.57% <0.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wanghan-iapcm wanghan-iapcm merged commit 787e2d3 into deepmodeling:devel Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] DP throw a Python error when used
2 participants