How do you use the scalene extension with VS Code? #703
-
When I introduce the lines: scalene_profiler.start() at the beginning and end of my python scripts and run them from VS Code, I get this error: "ERROR: Do not try to invoke That doesn't happen if I run it on the terminal by doing: % scalene script.py but then, I wonder, how does one profile scripts with the VS Code extension? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
To use the extension, you don't modify your code at all! You just run the extension on your program. |
Beta Was this translation helpful? Give feedback.
-
Thanks. I'm not sure what you mean by running the extension on my program. I have the scalene extension installed in VS Code but when I execute a script, I don't get any 'profile.html' created. I only get this file to be created and the browser open it automatically if I run scalene from the terminal. |
Beta Was this translation helpful? Give feedback.
-
You need to click Command-Shift-P (or Ctrl-Shift-P) to open the Command Palette. Then select "Scalene: AI-powered profiling..." (you can start typing Scalene and it will pop up if it's installed). Run that and (assuming your code runs for a second or more) you will get a profile in a webview. |
Beta Was this translation helpful? Give feedback.
-
Thanks, It should work as you say but in my case it seems something is amiss. When I try, I get this error message: Process exited with error code JM Moltes gràcies per l'ajut i per la bona feina, Emery. Aquest profiler és excel·lent. Acabo d'escoltar el podcast Real Python i veig que et podria haver fet la pregunta en català. |
Beta Was this translation helpful? Give feedback.
You need to click Command-Shift-P (or Ctrl-Shift-P) to open the Command Palette. Then select "Scalene: AI-powered profiling..." (you can start typing Scalene and it will pop up if it's installed).
Run that and (assuming your code runs for a second or more) you will get a profile in a webview.