Skip to content
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

Error: AttributeError on sys.orig_argv in etwtrace.pth During Python Startup #8156

Closed
StellaHuang95 opened this issue Feb 3, 2025 · 3 comments
Assignees

Comments

@StellaHuang95
Copy link
Contributor

Describe the bug
[A clear and concise description of the bug]

Steps to Reproduce

  1. Create a Python project in VS
  2. Download and install Python runtime from VS installer
  3. Run the Python project

The following error occurs:

Error processing line 2 of C:\Users\stellahuang\AppData\Local\Programs\Python\Python39\etwtrace.pth:

  Traceback (most recent call last):
    File "C:\Users\stellahuang\AppData\Local\Programs\Python\Python39\lib\site.py", line 169, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "C:\users\stellahuang\appdata\local\microsoft\visualstudio\17.0_b3c0adfcexp\extensions\microsoft corporation\python - profiling\17.0.0\etwtrace\__init__.py", line 136, in enable_if
      if sys.orig_argv[1:3] == ["-m", "etwtrace"]:
  AttributeError: module 'sys' has no attribute 'orig_argv'

Remainder of file ignored
Press any key to continue . . .
@StellaHuang95
Copy link
Contributor Author

This is because sys.orig_argv is a built-in attribute that's only available in Python >= 3.10.

@AdamYoblick The .pth file is a mechanism to execute initialization code during Python startup. Do you know why etwtrace.pth is present in C:\Users\stellahuang\AppData\Local\Programs\Python\Python39? I was expecting it to only be at %LocalAppData%\Microsoft\VisualStudio\<Version>\Extensions\Microsoft Corporation\Python - Profiling\<Version>\etwtrace

@AdamYoblick
Copy link
Member

Hmm I'm not sure. Have you pip installed the retrace package into your local 3.9 environment? Otherwise I don't know, maybe Steve would know better :)

@StellaHuang95
Copy link
Contributor Author

I can't repro anymore, maybe I just accidentally copied it over during testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants