Skip to content

Commit fc27500

Browse files
committed
pybricks.connections.pybricks: fix not setting self.script_dir
In c719eb4, setting self.script_dir was incorrectly put in the legacy run function only which broke data logging to a file. This restores it to the correct place. Fixes: #40
1 parent ff32826 commit fc27500

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pybricksdev/connections/pybricks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ async def run(
308308
self.log_file = None
309309
self.output = []
310310
self.print_output = print_output
311+
self.script_dir, _ = os.path.split(py_path)
311312

312313
# maintain compatibility with older firmware (Pybricks profile < 1.2.0).
313314
if self._mpy_abi_version:
@@ -377,7 +378,6 @@ async def _legacy_run(self, py_path: str, wait: bool) -> None:
377378
Version of :meth:`run` for compatibility with older firmware ()
378379
"""
379380
# Compile the script to mpy format
380-
self.script_dir, _ = os.path.split(py_path)
381381
mpy = await compile_file(py_path, self._mpy_abi_version)
382382

383383
try:

0 commit comments

Comments
 (0)