Skip to content

Commit

Permalink
FIX: adding submodule dirs search
Browse files Browse the repository at this point in the history
  • Loading branch information
9and3 committed Apr 7, 2024
1 parent 1690a4e commit 1148fee
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions GH/PyGH/components/scriptsynccpy/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,23 @@ def safe_exec(self, path, globals, locals):
"""
try:
with open(path, 'r') as f:
# add the path of the file to use the modules
# add the path and sub directories to the sys path
path_dir = os.path.dirname(path)
sys.path.insert(0, path_dir)
sub_dirs = []
for root, dirs, files in os.walk(path_dir):
for d in dirs:
sub_dirs.append(os.path.join(root, d))
sys.path.extend([path_dir] + sub_dirs)

# reload all the modules also of the sub directories
for root, dirs, files in os.walk(path_dir):
for d in dirs:
self.reload_all_modules(os.path.join(root, d))
self.reload_all_modules(path_dir)

# refresh the python interpreter
importlib.invalidate_caches()

# parse the code
code = compile(f.read(), path, 'exec')
output = io.StringIO()
Expand Down
Binary file added GH/PyGH/examples/qwe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion VSCode/scriptsync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "git",
"url": "https://github.com/ibois-epfl/script-sync"
},
"version": "1.1.2",
"version": "1.1.3",
"engines": {
"vscode": "^1.85.0"
},
Expand Down
Binary file added yaker/Newtonsoft.Json.Rhino.dll
Binary file not shown.

0 comments on commit 1148fee

Please sign in to comment.