Closed schmave closed 1 year ago
Looks pretty good to me! What do you think about exiting immediately when we print the warning? Some arguments for that behavior:
I don't have a super strong opinion either way, but I do think it's worth thinking about.
How about both, main_directory and cwd? Also, I think we should hide the rest of the error message (the stack trace), so they only see the part telling them to rename or remove the offending file (and I think we should say that, "rename or remove"). Thx.
On Thu, Apr 13, 2023 at 1:33 PM Austin Schick @.***> wrote:
@.**** commented on this pull request.
In cmu_graphics/init.py https://github.com/cmu-cs-academy/desktop-cmu-graphics/pull/41#discussion_r1165837506 :
@@ -1,4 +1,56 @@ +import main +import os + +main_directory = os.path.dirname(main.file) +main_sibling_filenames = set(os.listdir())
I think we probably want to use main_directory in this call to os.listdir(). The docs say: "The first entry in the module search path is the directory that contains the input script". So we do want main_directory, not the current working directory.
— Reply to this email directly, view it on GitHub https://github.com/cmu-cs-academy/desktop-cmu-graphics/pull/41#pullrequestreview-1383905369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3PPRGKU4LFKUNGSYYTNQLXBA2HVANCNFSM6AAAAAAW5L2OQE . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>
Right, what Austin just said. Clear early fail.
On Thu, Apr 13, 2023 at 1:42 PM Austin Schick @.***> wrote:
Looks pretty good to me! What do you think about exiting immediately when we print the warning? Some arguments for that behavior:
- For some of these modules, we're pretty confident that the bad filename is going to cause a crash anyway
- Our warning could become lost above the stack trace when the program exits
- It might be nicer to fail immediately instead of waiting and failing in a confusing way down the line
I don't have a super strong opinion either way, but I do think it's worth thinking about.
— Reply to this email directly, view it on GitHub https://github.com/cmu-cs-academy/desktop-cmu-graphics/pull/41#issuecomment-1507369551, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3PPRDAWDB7Y6G6AW72UQDXBA3IJANCNFSM6AAAAAAW5L2OQE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@palascat100 and @josht04 I think this is ready for you to test. I'm leaving out Alex because he's on Linux, which Desktop CMU Graphics doesn't support.
Thanks!
This is a draft of a solution that could work. What do you think? Here's a sample error message: