-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use portable OS error codes so program doesn't crash #318
Conversation
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.
- I suggest using the Standard errno system symbols to avoid numeric constants that differ between platforms.
- We might need to test for other errors as well. I managed to get this error when trying an 80000 character dummy string in Python 3.9.13 at Windows 10:
ValueError: _getfinalpathname: path too long for Windows
- This is a typical problem where it helps a lot to have unit tests for different edge cases to make it easier to execute the same tests at all platforms (often several developers are involved because not all developers have access to all platforms). I suggest we start collecting such test code. Until we get a better structure for test code, I suggest some clearly marked unit test function at the bottom of the source file containing the major part of the code to be tested.
- Edit: I just checked this part of the code in PR Large scale refactoring #251 where @formatc1702 has made major changes on top of the
latest
branch which is the result of joining changes from several other PRs. It seems his new code assumes the string to be YAML source if it contains a newline character, and therefore don't need to check for error numbers. However, I don't know yet when we can expect Large scale refactoring #251 to be merged into thedev
branch. First, I expect thelatest
branch to be merged into thedev
branch this summer, but that code still contains the code with numeric constants you try to fix in this PR. If we also manage to finalize Large scale refactoring #251 during the summer, then this PR might get obsolete.
For my own use, is there currently any version of the program that supports both the generation of drawings with a titleblock as well as autogeneration of connectors? |
@RedshiftVelocities I just found out to my surprise that this PR was closed. I believe it was not intentional, but rather an automatic consequence of deleting the base branch of your PR (this is an unfortunate functionality of github). This base branch was one of several branches that got deleted when merging their PRs into the It might be hard to reopen such an automatically closed PR, but you should be able to rebase your branch on top of the current |
I think OSError had an update at some point. Anyhow this change fixes this version of the program.
The error code is 22 on windows, apparently
Co-authored-by: kvid <kvid@users.noreply.github.com>
Co-authored-by: kvid <kvid@users.noreply.github.com>
6d7ea1b
to
2a57a9c
Compare
I managed to re-create the deleted base branch at the exact same commit as it was when deleted earlier this summer. That enabled me to re-open this PR. Then I changed the base branch to |
In Windows might ValueError be raised instead of the already catched exceptions in some cases (depending on the Python version) Fixes point 2 of #318 (review)
I think OSError had an update at some point, and the error code the program looks for changed. Anyhow this change fixes the titleblock-added version of the program.