Skip to content

Commit

Permalink
Fix compatibility with Python 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ylep committed Apr 4, 2018
1 parent 746a76b commit 3aaaefc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/neuroglancer_scripts/file_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import gzip
import os
import pathlib

import neuroglancer_scripts.accessor
Expand Down Expand Up @@ -81,7 +82,7 @@ def store_file(self, relative_path, buf,
"are accepted")
mode = "wb" if overwrite else "xb"
try:
file_path.parent.mkdir(parents=True, exist_ok=True)
os.makedirs(str(file_path.parent), exist_ok=True)
if self.gzip and mime_type not in NO_COMPRESS_MIME_TYPES:
with gzip.open(
str(file_path.with_name(file_path.name + ".gz")),
Expand Down Expand Up @@ -122,7 +123,7 @@ def store_chunk(self, buf, key, chunk_coords,
chunk_path = self._chunk_path(key, chunk_coords)
mode = "wb" if overwrite else "xb"
try:
chunk_path.parent.mkdir(parents=True, exist_ok=True)
os.makedirs(str(chunk_path.parent), exist_ok=True)
if self.gzip and mime_type not in NO_COMPRESS_MIME_TYPES:
with gzip.open(
str(chunk_path.with_name(chunk_path.name + ".gz")),
Expand Down

0 comments on commit 3aaaefc

Please sign in to comment.