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

Launching with no open file: command 'python-tox.select' not found #29

Open
cedlemo opened this issue Oct 24, 2022 · 10 comments
Open

Launching with no open file: command 'python-tox.select' not found #29

cedlemo opened this issue Oct 24, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@cedlemo
Copy link

cedlemo commented Oct 24, 2022

Bug description

When I want to select a tox environment in my project I have an error popup that show the following message:
Command 'Select and run tox environment' resulted in an error (command 'python-tox.select' not found)
This problem occurs both localy and remotely with the remote ssh extension

To Reproduce

  1. hit the Crtl+P keys,
  2. start to write tox
  3. choose "select and run tox environment"
    Capture d’écran de 2022-10-24 13-41-04
@cedlemo cedlemo added the bug Something isn't working label Oct 24, 2022
@The-Compiler
Copy link
Owner

I have no idea why this would be happening, I'm afraid. At the same place that command is defined, we also define that command as an activation event, and we register that command.

Could you take a look at the "output" panel of VS Code, especially the "Log (Extension Host)" output there? You should see something like: [2022-10-24 15:52:08.386] [exthost] [info] ExtensionService#_doActivateExtension the-compiler.python-tox, startup: false, activationEvent: 'onCommand:python-tox.select'

Do you see that? Do you see any errors?

@The-Compiler The-Compiler changed the title Unable to select the tox environment selection window command 'python-tox.select' not found Oct 24, 2022
@cedlemo
Copy link
Author

cedlemo commented Oct 25, 2022

@The-Compiler ,
If I test my project locally when I have the output panel with the Log(Extension Host) , I have the following output:

[2022-10-25 08:44:48.297] [exthost] [info] ExtensionService#_doActivateExtension the-compiler.python-tox, startup: false, activationEvent: 'onCommand:python-tox.select'
[2022-10-25 08:44:48.342] [exthost] [error] Activating extension the-compiler.python-tox failed due to an error:
[2022-10-25 08:44:48.342] [exthost] [error] Error: No active editor found.
	at findProjectDir (/home/cedlemo/.vscode/extensions/the-compiler.python-tox-1.0.0/out/utils.js:10:15)
	at activate (/home/clemoigne/.vscode/extensions/the-compiler.python-tox-1.0.0/out/extension.js:14:53)
	at Fn._callActivateOptional (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:17678)
	at Fn._callActivate (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:17338)
	at /usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:15133
	at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async E._activate (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:8191)
	at async E._waitForDepsThenActivate (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:8133)
	at async E._initialize (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:7497)

If I test with remote ssh (which is how I dev):

I have a little error toast that is displayed with the following message:
Command failed: tox -a ERROR: tox config file (either pyproject.toml, tox.ini, setup.cfg) not found.

For information, my tox.ini is not directly in the workspace directory but in a subdirectory

@The-Compiler
Copy link
Owner

I opened #30 for the "tox.ini in a subdirectory" thing, because that'd be a feature request. But we should certainly handle this issue more gracefully.

It fails with "Error: No active editor found.", so I'm guessing you're starting the extension without a file active? Does anything change if you open a file in your project and start it then?

@cedlemo
Copy link
Author

cedlemo commented Oct 25, 2022

@The-Compiler,

You are right, if I open a file the error "No active editor found" disappears, and now the error is the same locally and remotely:
Command failed: tox -a ERROR: tox config file (either pyproject.toml, tox.ini, setup.cfg) not found.

@The-Compiler The-Compiler changed the title command 'python-tox.select' not found Launching with no open file: command 'python-tox.select' not found Oct 25, 2022
@The-Compiler
Copy link
Owner

Right, so we're getting closer! Unfortunately I still can't reproduce myself, I get this instead:

image

What version of VS Code are you running?

@cedlemo
Copy link
Author

cedlemo commented Oct 25, 2022

I use VSCode on ubuntu, installed with the package manager:

Version: 1.72.2
Commit: d045a5eda657f4d7b676dedbfa7aab8207f8a075
Date: 2022-10-12T22:16:26.920Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 5.15.0-52-generic
Sandboxed: No

@The-Compiler
Copy link
Owner

I'm running 1.72.0 here, so I doubt that'd make much of a difference. But I suppose I can try a fix without reproducing it. I'm afraid it'll take me a bit, as I'm busy with other projects for the next couple of weeks to months.

As for #30, that's something I don't really use myself. I'll look into adding a workspace config option or somesuch, but it'll probably take some time too.

@cedlemo
Copy link
Author

cedlemo commented Oct 25, 2022

thanks for your help. I will look if I can add such option myself and propose you a PR if you are willing to accept it.

@The-Compiler
Copy link
Owner

Sure, please go ahead! Also see #1 and #7 which talk about how to discover the project/workspace. I'm not quite sure if the current approach is the right one there. But I suppose finding the tox.ini in the workspace is kind of orthogonal to that anyways!

Another approach there would be to search it recursively (perhaps up to a certain level) in the workspace, but that might cause trouble with virtualenv's and such. Thus I'd indeed propose having a simple workspace setting for where to find the tox.ini, with the workspace root as default. "Implicit is better than implicit", after all, and I suspect the vast majority of projects will have the tox.ini in the workspace root.

@areche
Copy link

areche commented Apr 27, 2023

I had the Command failed: tox -a ERROR: tox config file (either pyproject.toml, tox.ini, setup.cfg) not found. error and I found out that is because my project was using a virtual environment with tox on it, but the python-tox extension uses the system python environment in which I do not have tox.

By installing tox in my system python environment the problem was solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants