-
Notifications
You must be signed in to change notification settings - Fork 540
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
AddPythonApp crashes because it does not double quote paths with spaces in arguments list #6841
Comments
Seems like this should be an easy fix. |
I tried to simply double quote the path in 626f743. However, things aren't working when I do that. The app fails to run:
|
Trying to do this outside of Aspire results in the same behavior as originally noted in the top post: D:\My Temp\AspireWithPython\InstrumentedPythonProject>.venv\Scripts\opentelemetry-instrument.exe --traces_exporter otlp --logs_exporter console,otlp --metrics_exporter otlp "D:\My Temp\AspireWithPython\InstrumentedPythonProject\.venv\Scripts\python.exe" app.py
D:\My: can't open file 'D:\\My Temp\\AspireWithPython\\InstrumentedPythonProject\\Temp\\AspireWithPython\\InstrumentedPythonProject\\.venv\\Scripts\\python.exe': [Errno 2] No such file or directory I believe this is an argument parsing issue in I've opened Executing opentelemetry-instrument.exe on an app with a path with space doesn't work (open-telemetry/opentelemetry-python-contrib#3238) for this. |
I did more digging, and it looks like we shouldn't double quote paths at all. This is handled for us via DCP. We keep each argument separate in a aspire/src/Aspire.Hosting/Dcp/Model/Executable.cs Lines 24 to 28 in c1c9666
DCP takes these separate args and will combine them correctly if an individual arg contains a space or tab. So I'm closing this issue as .NET Aspire code is doing the correct thing. The underlying issue is in opentelemetry-instrument.exe - open-telemetry/opentelemetry-python-contrib#3238. |
Is there an existing issue for this?
Describe the bug
AddPythonApp does not double quote paths it passes as arguments, especially the Python executable in venv when passed to the OpenTelemetry instrumentation executable.
![Image](https://private-user-images.githubusercontent.com/675679/390798939-5f315dae-efb8-427d-b241-d1783ff20abe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTY0MjEsIm5iZiI6MTczOTU5NjEyMSwicGF0aCI6Ii82NzU2NzkvMzkwNzk4OTM5LTVmMzE1ZGFlLWVmYjgtNDI3ZC1iMjQxLWQxNzgzZmYyMGFiZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQwNTA4NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jZWQ5OWQ3MDlmODNkMjc2NzlkZWRmMjFmYzgyYWI1ZjU4MTYxNGE1NWVkYThkNjE4ZjZjZDEzYTE4MGQyNWNkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.3SHcb2j2Jzc-7u7AQ54UfEMBA7j3entQdFbRD82e1Bs)
Example :
This results in the python script not starting because the argument list is not parsed correctly when there are spaces in the full path.
![Image](https://private-user-images.githubusercontent.com/675679/390799472-938c2d8c-c026-4bf5-a6fc-944c2eb006f9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTY0MjEsIm5iZiI6MTczOTU5NjEyMSwicGF0aCI6Ii82NzU2NzkvMzkwNzk5NDcyLTkzOGMyZDhjLWMwMjYtNGJmNS1hNmZjLTk0NGMyZWIwMDZmOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQwNTA4NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05YzYyMWE4N2FlMzJkNTUyZDU5OWJlNDU5NTJlNWMyNDQ5MjI3NzhkNDMxNDNjZjczNjEyNTEyYTBhOTFmZTViJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.7FBIIUZJ_DpkVTzSE4x2AeGU1XtLgTYn7SJvRT0fmKw)
Expected Behavior
The path should double quoted within the argument list to avoid this issue.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version info
SDK .NET :
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.7+5b8665660
Anything else?
Aspire 9.0.0 and Aspire.Hosting.Python 9.0.0
The text was updated successfully, but these errors were encountered: