Skip to content

Commit 38c2534

Browse files
committed
Fix Windows file path for extracting from ZipFile (resolves #7)
1 parent a6b79b0 commit 38c2534

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spice/get_stanford_models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ def get_stanford_models():
2828
print()
2929
print('Extracting {} ...'.format(JAR))
3030
file_name = os.path.join(CORENLP, JAR)
31+
# file names in zip use '/' separator regardless of OS
32+
zip_file_name = '/'.join([CORENLP, JAR])
3133
target_name = os.path.join(SPICEDIR, SPICELIB, JAR)
3234
for filef in ['{}.jar', '{}-models.jar']:
33-
extract_file = filef.format(file_name)
34-
ZipFile(zip_file).extract(extract_file, SPICEDIR)
35-
os.rename(os.path.join(SPICEDIR, extract_file),
35+
ZipFile(zip_file).extract(filef.format(zip_file_name), SPICEDIR)
36+
os.rename(os.path.join(SPICEDIR, filef.format(file_name)),
3637
filef.format(target_name))
3738

3839
os.rmdir(os.path.join(SPICEDIR, CORENLP))

0 commit comments

Comments
 (0)