Skip to content

Commit c6b764b

Browse files
Fixed encoding while reading notebook in some platforms (#354)
* Fixed encoding while reading notebook in some platforms * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 8758049 commit c6b764b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jupyter_scheduler/executors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from jupyter_scheduler.models import DescribeJob, JobFeature, Status
1313
from jupyter_scheduler.orm import Job, create_session
1414
from jupyter_scheduler.parameterize import add_parameters
15-
from jupyter_scheduler.utils import get_utc_timestamp, resolve_path
15+
from jupyter_scheduler.utils import get_utc_timestamp
1616

1717

1818
class ExecutionManager(ABC):
@@ -123,7 +123,7 @@ class DefaultExecutionManager(ExecutionManager):
123123
def execute(self):
124124
job = self.model
125125

126-
with open(self.staging_paths["input"]) as f:
126+
with open(self.staging_paths["input"], encoding="utf-8") as f:
127127
nb = nbformat.read(f, as_version=4)
128128

129129
if job.parameters:
@@ -163,7 +163,7 @@ def supported_features(cls) -> Dict[JobFeature, bool]:
163163
}
164164

165165
def validate(cls, input_path: str) -> bool:
166-
with open(input_path) as f:
166+
with open(input_path, encoding="utf-8") as f:
167167
nb = nbformat.read(f, as_version=4)
168168
try:
169169
nb.metadata.kernelspec["name"]
@@ -186,7 +186,7 @@ class ArchivingExecutionManager(DefaultExecutionManager):
186186
def execute(self):
187187
job = self.model
188188

189-
with open(self.staging_paths["input"]) as f:
189+
with open(self.staging_paths["input"], encoding="utf-8") as f:
190190
nb = nbformat.read(f, as_version=4)
191191

192192
if job.parameters:

0 commit comments

Comments
 (0)