py-spy icon indicating copy to clipboard operation
py-spy copied to clipboard

Encounter os error 31 with py-spy record

Open Piidas opened this issue 2 years ago • 3 comments

Hi there,

I encounter the following error: Error: Failed to get process executable name. Check that the process is running. Reason: A device attached to the system is not functioning. (os error 31) Reason: A device attached to the system is not functioning. (os error 31)

I started py-spy as follows running the CMD as Administrator: py-spy record -o profile.svg -- C:\Users\ACER\AppData\Local\Programs\Python\Python310\python.exe TesterCopy.py

I get the same error when I use python 3.10.8 and 3.11.5.

I also tried to profile this python script and another one too.

I also tried my local machine (windows 11) and a virtual machine from AWS - same error.

I use py-spy version 0.3.14.

Hope not to report a stupid mistake here. Thanks for you support and all the best! Piidas

Piidas avatar Nov 13 '23 18:11 Piidas

ME too . Has to do with pyenv?

eyalk11 avatar Oct 26 '24 13:10 eyalk11

Hi, I've encountered the same problem.

  • Windows version: 10.0.19045.0
  • PowerShell version: 7.5.0

I am in a virtual environment.

  • Python version: 3.12.9
  • py-spy version: 0.4.0

Minimal reproducible script simple.py:

import sys

def main() -> int:
    return 0

if __name__ == "__main__":
    sys.exit(main())

To reproduce run

py-spy record -o simple.svg -- python simple.py

cmp0xff avatar Feb 21 '25 14:02 cmp0xff

Yes, I was completely unable to use py-spy on Windows and had to switch to a Linux machine

relativityspace-jsmith avatar Feb 24 '25 20:02 relativityspace-jsmith