From 739b1dade36e11d3cbcb7d91db1223127bf76be3 Mon Sep 17 00:00:00 2001 From: RedshiftVelocities <43499473+RedshiftVelocities@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:47:04 -0600 Subject: [PATCH 1/5] Update error code so program doesn't crash I think OSError had an update at some point. Anyhow this change fixes this version of the program. --- src/wireviz/wireviz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index 11016192..a28485b6 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -393,7 +393,7 @@ def _get_yaml_data_and_path(inp: Union[str, Path, Dict]) -> (Dict, Path): # if inp is a long YAML string, Pathlib will raise OSError: [Errno 63] # when trying to expand and resolve it as a path. # Catch this error, but raise any others - if type(e) is OSError and e.errno != 63: + if type(e) is OSError and e.errno != 36: raise e # file does not exist; assume inp is a YAML string yaml_str = inp From b841400f550f732aa50e5f55a6f778d5fb45c65c Mon Sep 17 00:00:00 2001 From: RedshiftVelocities <43499473+RedshiftVelocities@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:57:55 -0600 Subject: [PATCH 2/5] Update to work on windows too The error code is 22 on windows, apparently --- src/wireviz/wireviz.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index a28485b6..44c30f9c 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -393,7 +393,8 @@ def _get_yaml_data_and_path(inp: Union[str, Path, Dict]) -> (Dict, Path): # if inp is a long YAML string, Pathlib will raise OSError: [Errno 63] # when trying to expand and resolve it as a path. # Catch this error, but raise any others - if type(e) is OSError and e.errno != 36: + print(e.errno) + if type(e) is OSError and e.errno != 36 and e.errno != 22: raise e # file does not exist; assume inp is a YAML string yaml_str = inp From daf8f1c1c08f663332b2dd6d554223d3ebd2165c Mon Sep 17 00:00:00 2001 From: RedshiftVelocities <43499473+RedshiftVelocities@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:58:11 -0600 Subject: [PATCH 3/5] Update wireviz.py --- src/wireviz/wireviz.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index 44c30f9c..7f78bb2a 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -393,7 +393,6 @@ def _get_yaml_data_and_path(inp: Union[str, Path, Dict]) -> (Dict, Path): # if inp is a long YAML string, Pathlib will raise OSError: [Errno 63] # when trying to expand and resolve it as a path. # Catch this error, but raise any others - print(e.errno) if type(e) is OSError and e.errno != 36 and e.errno != 22: raise e # file does not exist; assume inp is a YAML string From 4b759ee29706eb88bd493d6cac830f149983195f Mon Sep 17 00:00:00 2001 From: RedshiftVelocities <43499473+RedshiftVelocities@users.noreply.github.com> Date: Fri, 2 Jun 2023 09:35:07 -0600 Subject: [PATCH 4/5] Update src/wireviz/wireviz.py Co-authored-by: kvid --- src/wireviz/wireviz.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index 7f78bb2a..0967c187 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -393,7 +393,8 @@ def _get_yaml_data_and_path(inp: Union[str, Path, Dict]) -> (Dict, Path): # if inp is a long YAML string, Pathlib will raise OSError: [Errno 63] # when trying to expand and resolve it as a path. # Catch this error, but raise any others - if type(e) is OSError and e.errno != 36 and e.errno != 22: + from errno import ENAMETOOLONG + if type(e) is OSError and e.errno != ENAMETOOLONG: raise e # file does not exist; assume inp is a YAML string yaml_str = inp From 2a57a9c33d45d05941bb86b06ddeb4a351d40299 Mon Sep 17 00:00:00 2001 From: RedshiftVelocities <43499473+RedshiftVelocities@users.noreply.github.com> Date: Fri, 2 Jun 2023 09:35:12 -0600 Subject: [PATCH 5/5] Update src/wireviz/wireviz.py Co-authored-by: kvid --- src/wireviz/wireviz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index 0967c187..163be954 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -390,7 +390,7 @@ def _get_yaml_data_and_path(inp: Union[str, Path, Dict]) -> (Dict, Path): # if no FileNotFoundError exception happens, get file contents yaml_str = open_file_read(yaml_path).read() except (FileNotFoundError, OSError) as e: - # if inp is a long YAML string, Pathlib will raise OSError: [Errno 63] + # if inp is a long YAML string, Pathlib will raise OSError: [errno.ENAMETOOLONG] # when trying to expand and resolve it as a path. # Catch this error, but raise any others from errno import ENAMETOOLONG