-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
In code_utils.py, handling NotADirectoryError as well in get_powershell_command #1948
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1948 +/- ##
===========================================
+ Coverage 37.33% 47.76% +10.42%
===========================================
Files 64 64
Lines 6913 6913
Branches 1519 1650 +131
===========================================
+ Hits 2581 3302 +721
+ Misses 4109 3336 -773
- Partials 223 275 +52
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@lestan could you test this PR in your environment? Thanks. |
Thanks for looking into this and sharing your explanation. By that logic, shouldn't the function check for WIN32 before going into the main if statement and return None for any other platform? Seems unnecessary to execute the logic, trigger exceptions and handle them twice when we know that PowerShell is only available on Windows. Thanks Les |
That is a good suggestion but as far as I know it is possible to install and use powershell in various linux distributions as well and is a commonly followed practice so that's why it might be better to check the win32 condition later as I have given in the code |
Hi @abhaymathur21 and @sonichi, I checked out the pr and built and ran it successfully. To test, I ran the test/twoagent.py and the test_chats test from test/agentchat/test_chats.py. Both tests passed. Confirming the changes are good. Thank you for the quick response to this! Let me know if you need anything more from me to merge this pr. Looking forward to getting the fix into the next release! |
Happy to help! Thank you for pointing this issue out. |
Confirmed this is working as expected in release 0.2.18! ⭐ |
Why are these changes needed?
On MacOS for example, the windows powershell directory does not even exist and the python subprocess looks for the powershell directory in the path and throws a NotADirectoryError. In windows, the powershell directory exists so that error is not thrown but the file name may be different (powershell.exe or pwsh.exe) so a FileNotFoundError is thrown.
We must be able to deal with both these scenarios, hence these changes are necessary.
Related issue number
Closes #1947
Checks