robotcodedev / robotcode

RobotFramework support for Visual Studio Code
https://robotcode.io
Apache License 2.0
168 stars 13 forks source link

[BUG] "No module named 'robotcode.plugin'" error when using robotcode cli #206

Closed DetachHead closed 5 months ago

DetachHead commented 5 months ago

Describe the bug when attempting to run the robotcode command from the pypi package, the following error occurs:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\user\project\.venv\Scripts\robotcode.exe\__main__.py", line 4, in <module>
  File "C:\Users\user\project\.venv\Lib\site-packages\robotcode\cli\__init__.py", line 9, in <module>
    from robotcode.plugin import (
ModuleNotFoundError: No module named 'robotcode.plugin'

To Reproduce run the following commands:

  1. pip install robotcode
  2. robotcode

Expected behavior robotcode cli runs on my project like it does in the vscode extension

Desktop (please complete the following information):

Additional context i'm not sure if the cli is even intended to be used outside of the extension like this, but my use case is to add a robotcode check in my CI to match the checks the vscode extension does locally

d-biehl commented 5 months ago

Thanks for the issue, I have corrected it.

The RobotCode Command Line Interface is used internally by RobotCode, some parts are already finished but others not yet, I'm still working on it.

What is still missing as a major point is the analysis of a Robot Framework project, i.e. "Keyword not found" and something like that, the language server already does this, but it doesn't work on the command line yet.

At RoboCon 2024 Online I will be giving a tutorial on RobotCode CLI Tools, I want to have it ready by then, so please be patient ;-) By then there will also be a little more documentation.

But as a short outlook: Installing the "robotcode" package alone is useless, it is only the common interface to the individual tools. Since you don't need all the tools in a CI environment, e.g. the language server, you have to specify the actual tool or install the package directly.

So for the RobotCode Runner e.g.

pip install robotcode-runner

or

pip install robotcode[runner]

there are the following tools that currently work:

the following will follow:

As I said, you have to be patient until RoboCon Online...

On https://robotcode.io you can already find a version of the documentation under the tab CLI

DetachHead commented 4 months ago

Thanks for the issue, I have corrected it.

is this fix in 0.76.0? because i still get the same error in that version:

> robotcode --help
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\project\.venv\Scripts\robotcode.exe\__main__.py", line 4, in <module>
  File "C:\project\.venv\Lib\site-packages\robotcode\cli\__init__.py", line 9, in <module>
    from robotcode.plugin import (
ModuleNotFoundError: No module named 'robotcode.plugin'
d-biehl commented 4 months ago

What did you install?

DetachHead commented 4 months ago

pip install robotcode

d-biehl commented 4 months ago

this is now really fixed with 0.76.2.

It is not enough to only install the robotcode package you need to specify also a tool like runner, debugger or so.

like pip install robotcode[runner] or pip intstall robotcode-runner or pip install robotcode[debugger] or pip intstall robotcode-debugger

or if you want to install all use pip install robotcode[all]

DetachHead commented 4 months ago

works now, thanks!