make it compatible with windows
Browse files
zenodo.py
CHANGED
|
@@ -2,8 +2,9 @@
|
|
| 2 |
Huggingface datasets script for Zenodo dataset.
|
| 3 |
"""
|
| 4 |
|
| 5 |
-
import json
|
| 6 |
import os
|
|
|
|
|
|
|
| 7 |
|
| 8 |
import datasets
|
| 9 |
|
|
@@ -48,8 +49,12 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
| 48 |
def _generate_examples(self, filepath):
|
| 49 |
# lets rename the file to the original name
|
| 50 |
# copy file to the current directory without os specific commands
|
| 51 |
-
os.
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
|
| 55 |
yield 0, {"path": filepath}
|
|
|
|
| 2 |
Huggingface datasets script for Zenodo dataset.
|
| 3 |
"""
|
| 4 |
|
|
|
|
| 5 |
import os
|
| 6 |
+
import shutil
|
| 7 |
+
import json
|
| 8 |
|
| 9 |
import datasets
|
| 10 |
|
|
|
|
| 49 |
def _generate_examples(self, filepath):
|
| 50 |
# lets rename the file to the original name
|
| 51 |
# copy file to the current directory without os specific commands
|
| 52 |
+
current_directory = os.getcwd()
|
| 53 |
+
|
| 54 |
+
# os.system(f"cp {filepath} .")
|
| 55 |
+
# os.system(f"mv {os.path.basename(filepath)} {self.filename}")
|
| 56 |
+
shutil.copy(filepath, current_directory)
|
| 57 |
+
os.rename(os.path.basename(filepath), self.filename)
|
| 58 |
|
| 59 |
|
| 60 |
yield 0, {"path": filepath}
|