You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just read about reloading on Medium, installed the latest version with pip, but failed to get even the simple starting example to run using VS-Code as my IDE:
>>> from reloading import reloading
>>> for i in reloading(range(10)):
... # this code will be reloaded before each iteration
... print(i)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\peter\AppData\Roaming\Python\Python311\site-packages\reloading\reloading.py", line 45, in reloading
return _reloading_loop(fn_or_seq, every=every)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\peter\AppData\Roaming\Python\Python311\site-packages\reloading\reloading.py", line 168, in _reloading_loop
compiled_body, itervars, loop_id = get_loop_code(loop_frame_info, loop_id=loop_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\peter\AppData\Roaming\Python\Python311\site-packages\reloading\reloading.py", line 138, in get_loop_code
tree = parse_file_until_successful(fpath)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\peter\AppData\Roaming\Python\Python311\site-packages\reloading\reloading.py", line 88, in parse_file_until_successful
source = load_file(path)
^^^^^^^^^^^^^^^
File "C:\Users\peter\AppData\Roaming\Python\Python311\site-packages\reloading\reloading.py", line 82, in load_file
with open(path, "r") as f:
^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: '<stdin>'
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. It looks like vscode is piping the python source via stdin into the python interpreter. The current implementation of reloading can't see which file the source code came from when tracking source code changes.
To use reloading, please run the file directly, e.g. python my_module.py
I just read about
reloading
on Medium, installed the latest version with pip, but failed to get even the simple starting example to run using VS-Code as my IDE:The text was updated successfully, but these errors were encountered: