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

filename read error in pdfdataset.py #76

Open
stevenhua0320 opened this issue Aug 16, 2024 · 1 comment
Open

filename read error in pdfdataset.py #76

stevenhua0320 opened this issue Aug 16, 2024 · 1 comment

Comments

@stevenhua0320
Copy link
Contributor

When running script,. there is indexing error in reading the filename.
File "/Users/huarundong/dbs/diffpy.srmise/diffpy.srmise/src/diffpy/srmise/pdfdataset.py", line 407, in <module>
filename = sys.argv[1]
~~~~~~~~^^^
IndexError: list index out of range

@Ainamacar
Copy link
Contributor

This particular test script was intended to run with a command-line argument, a path to a file with a readable PDF. If you just run pdfdataset.py alone then sys.argv[1] does not exist. I'm sure you have access to many of these, but the repository already includes several in doc/examples/data. All the script does is read in the data then prints to the console the file's PDF metadata (e.g. qmax) and 4 columns of data.

As a temporary measure, include a path to such a file if you just want this script to run without error. However, this entire if __name__ == "__main__": block should be removed and replaced with a proper test. The code in this file is taken nearly verbatim from PDFgui (see file header) so you might be able to borrow tests from that project.

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