Giter Club home page Giter Club logo

Comments (4)

MHHenriksen avatar MHHenriksen commented on July 24, 2024 1

Thanks for the fix, it did the trick!
image

And I agree with your argument here, the LSP devs got this one wrong.

from robotframework-docker.

MHHenriksen avatar MHHenriksen commented on July 24, 2024

Found the stack trace in the output panel!

Traceback (most recent call last):

  File "C:\code\rob2\.micromamba\envs\robot\Lib\site-packages\DockerComposeLibrary.py", line 60, in __init__

    self._project_name = re.sub(r'\W', '_', BuiltIn().get_variable_value('${SUITE NAME}'), re.ASCII).lower()

                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\code\rob2\.micromamba\envs\robot\Lib\site-packages\robot\libraries\BuiltIn.py", line 1502, in get_variable_value

    name = self._get_var_name(name, require_assign=False)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\code\rob2\.micromamba\envs\robot\Lib\site-packages\robot\libraries\BuiltIn.py", line 1780, in _get_var_name

    replaced = self._variables.replace_string(original)

               ^^^^^^^^^^^^^^^

  File "C:\code\rob2\.micromamba\envs\robot\Lib\site-packages\robot\libraries\BuiltIn.py", line 71, in _variables

    return self._namespace.variables

           ^^^^^^^^^^^^^^^

  File "C:\code\rob2\.micromamba\envs\robot\Lib\site-packages\robot\libraries\BuiltIn.py", line 67, in _namespace

    return self._get_context().namespace

           ^^^^^^^^^^^^^^^^^^^

  File "C:\code\rob2\.micromamba\envs\robot\Lib\site-packages\robot\libraries\BuiltIn.py", line 62, in _get_context

    raise RobotNotRunningError('Cannot access execution context')

robot.libraries.BuiltIn.RobotNotRunningError: Cannot access execution context


from robotframework-docker.

MHHenriksen avatar MHHenriksen commented on July 24, 2024

Here's an old issue in the LSP repo discussing the same problem for a different library: robocorp/robotframework-lsp#166

from robotframework-docker.

vogoltsov avatar vogoltsov commented on July 24, 2024

As I see it, LSP tries to get access to the library instance (for introspection?), but assumes the library would not initialise itself before being used or doesn't depend on Robotframework during initialisation.

As initialising a library in __init__ seems to be the official correct way to do it in Robotframework, this assumption is wrong. That's why they suggest to defer initialisation in the library.

As this is not that big of an issue with this library, I fixed it by catching the RobotNotRunningError. But overall I think it's more of an issue of LPS making incorrect presumptions about the library lifecycle.

Could you give this a try in version 1.4.2?

from robotframework-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.