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

CifFile.WriteOut() unavoidably prints to stdout #8

Open
kalekundert opened this issue Jan 31, 2024 · 2 comments
Open

CifFile.WriteOut() unavoidably prints to stdout #8

kalekundert opened this issue Jan 31, 2024 · 2 comments

Comments

@kalekundert
Copy link

Here's a minimal example:

>>> from CifFile import CifFile, CifBlock
>>> cf['9xyz'] = CifBlock()
>>> x = cf.WriteOut()
Writing 9xyz, <CifFile.CifFile_module.CifBlock object at 0x71f505f7e620>
All blocks output.

If I want to control the output my program shows to the user, this is pretty annoying behavior. At the very least, I think there should be a way to silence these messages (e.g. cf.WriteOut(verbose=False)). But really, I think they should just be removed.

Looking at the source code, I see that there are a few other messages that get printed when something unexpected happens. I don't have as much issue with these, since they might help catch what would otherwise be silent errors. In a perfect world, though, these messages would probably go through the logging system.

I did try to make a PR for this, since it's a pretty small issue, but I couldn't figure out how to install the library from source. I've also never encountered *.nw files before, so I wasn't really sure if I making the right changes. If you can give me some pointers about these issues, though, I'd still be happy to make a PR.

@jamesrhester
Copy link
Owner

Thanks for this suggestion. I can make the change to the .nw file. nw is noweb, a now no-longer maintained literate programming approach which does not run on Windows, it seems.

@jamesrhester
Copy link
Owner

I've commented out the offending lines in StarFile.nw.

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