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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
Do you happen to know how rhosetter.py is found in this case? I tried moving both rhosetter files into a setters subdirectory, then using --rho-cfgfile=setters/rhosetter_FS_only.py. This worked fine, but I wouldn't actually have expected it to. If I break into the code just below this comment, I find that sys.path includes . (the main directory) but not setters. Nevertheless, when from rhosetter import set_rho_values runs, it manages to find rhosetter.py inside the setters directory. I wouldn't expect that to happen.
The reason will be displayed to describe this comment to others. Learn more.
The rho-cfgsetter import stack trace is roughly:
pyomo.pysp.ph:ProgressiveHedging.init() -> pyomo.pysp.util.misc:load_external_module() -> pyutilib.misc:import_file()
import_file works some magic to parse a path into a directory + module, then temporarily adds that directory to the beginning of sys.path (list of directories to search for python libraries & modules).
121fb87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you happen to know how
rhosetter.py
is found in this case? I tried moving both rhosetter files into asetters
subdirectory, then using--rho-cfgfile=setters/rhosetter_FS_only.py
. This worked fine, but I wouldn't actually have expected it to. If I break into the code just below this comment, I find thatsys.path
includes.
(the main directory) but notsetters
. Nevertheless, whenfrom rhosetter import set_rho_values
runs, it manages to find rhosetter.py inside thesetters
directory. I wouldn't expect that to happen.121fb87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rho-cfgsetter import stack trace is roughly:
pyomo.pysp.ph:ProgressiveHedging.init() -> pyomo.pysp.util.misc:load_external_module() -> pyutilib.misc:import_file()
import_file works some magic to parse a path into a directory + module, then temporarily adds that directory to the beginning of sys.path (list of directories to search for python libraries & modules).
https://github.com/PyUtilib/pyutilib/blob/master/pyutilib/misc/import_file.py