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

Warning Regarding Implicit Binary/Text Mode in zopen for getcif Usage #3

Open
k-yoshimi opened this issue Dec 13, 2024 · 0 comments
Open
Assignees

Comments

@k-yoshimi
Copy link
Contributor

When using getcif, the following warning is displayed:

/Users/k-yoshimi/miniconda3/envs/my_pymatgen/lib/python3.12/site-packages/pymatgen/io/cif.py:1764: FutureWarning: We strongly discourage using implicit binary/text `mode`, and this would not be allowed after 2025-06-01. I.e. you should pass t/b in `mode`.
with zopen(filename, mode=mode) as file:

This warning indicates that the use of an implicit binary/text mode with zopen will no longer be allowed after June 1, 2025. To ensure compatibility with future versions, it is recommended to explicitly specify 't' (text) or 'b' (binary) in the mode argument when opening files.

Proposed Solution:
Update the zopen call in getcif to explicitly specify the file mode ('t' or 'b'), as suggested in the warning. This change will ensure compatibility with future versions of Python and avoid potential runtime errors.

Please let me know if any additional details or clarification are required.

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