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

Issue downloading zip dataset files from RRUFF site on Windows #24

Open
RobertASu1 opened this issue Aug 15, 2024 · 0 comments
Open

Issue downloading zip dataset files from RRUFF site on Windows #24

RobertASu1 opened this issue Aug 15, 2024 · 0 comments

Comments

@RobertASu1
Copy link

RobertASu1 commented Aug 15, 2024

I have a problem when trying to download a dataset from the rruff database. Using this slightly modified code from the Ramanspy doc site.

"""
Loading the RRUFF dataset

In this tutorial, we will see how to load the :ref:RRUFF data using RamanSPy.

"""
import sys
sys.path.append("c:\Pythoncode\Ramanspy\virt\Lib\site-packages")
import ramanspy
dataset_name = 'poor_oriented'
ramanspy.datasets.rruff("c:\Pythoncode\Ramanspy", download=True)

  I get this error message in Visual Studio code.  I'm using Windows 11.

File "c:\Pythoncode\Ramanspy\virt\ii_rruff.py", line 21, in
    ramanspy.datasets.rruff("c:\Pythoncode\Ramanspy", download=True)
  File "c:\Pythoncode\Ramanspy\virt\Lib\site-packages\ramanspy\datasets.py", line 464, in rruff
    return _download_rruff(dataset)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Pythoncode\Ramanspy\virt\Lib\site-packages\ramanspy\datasets.py", line 478, in download_rruff
    with ZipFile(BytesIO(zipresp.read())) as zipfile:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\RobertS\AppData\Local\Programs\Python\Python312\Lib\zipfile_init
.py", line 1339, in init
    self.RealGetContents()
  File "C:\Users\RobertS\AppData\Local\Programs\Python\Python312\Lib\zipfile_init
.py", line 1406, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file error when script is run

cody says the error error is occurring in the ramanspy library's dataset downloading functionality, so ensuring you have the latest version of the library might also help, but I just installed the program less than a week ago and I'm sure that's not the problem. I'm using 0.2.10. When I download and extract the zip file with Windows and run a ramanspy script to print out the metadata such as this:

dataset_name = 'fair_oriented' # Replace with the desired dataset name
spectra, metadata = rp.datasets.rruff(dataset_name, download=False) # Display some information about the loaded spectra
print(f"Loaded spectra for dataset: {dataset_name}")
print(f"Number of spectra: {len(spectra)}")
print(f"Metadata: {metadata}")

It prints out everything as it should, so I'm wondering if the problem is the zip files are in the wrong format at the RRUFF database?

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

1 participant