Fix IDE info when running in pure python console

This commit is contained in:
allegroai 2022-12-29 13:12:58 +02:00
parent af79ee7839
commit 3371a58bcb
2 changed files with 12 additions and 5 deletions

View File

@ -873,6 +873,10 @@ class ScriptInfo(object):
scripts_path = [Path(cls._absolute_path(os.path.normpath(f), cwd)) for f in filepaths if f] scripts_path = [Path(cls._absolute_path(os.path.normpath(f), cwd)) for f in filepaths if f]
scripts_path = [f for f in scripts_path if f.exists()] scripts_path = [f for f in scripts_path if f.exists()]
if not scripts_path: if not scripts_path:
for f in (filepaths or []):
if f and f.endswith("/<stdin>"):
raise ScriptInfoError("python console detected")
raise ScriptInfoError( raise ScriptInfoError(
"Script file {} could not be found".format(filepaths) "Script file {} could not be found".format(filepaths)
) )
@ -1056,6 +1060,8 @@ class ScriptInfo(object):
@classmethod @classmethod
def detect_running_module(cls, script_dict): def detect_running_module(cls, script_dict):
if not script_dict:
return script_dict
# noinspection PyBroadException # noinspection PyBroadException
try: try:
# If this is jupyter, do not try to detect the running module, we know what we have. # If this is jupyter, do not try to detect the running module, we know what we have.

View File

@ -275,6 +275,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
) )
# add ide info into task runtime_properties # add ide info into task runtime_properties
if result.script and result.script.get("ide"):
# noinspection PyBroadException # noinspection PyBroadException
try: try:
self._set_runtime_properties(runtime_properties={"ide": result.script["ide"]}) self._set_runtime_properties(runtime_properties={"ide": result.script["ide"]})