Skip to content

Jupyter support: __file__ not available #17

@danwos

Description

@danwos

If groundwork gets run inside a notebook like jupyter, the Plugin initialisation will fail, as file is not available.
The problem on detail:
GwBasePattern tries to find the location of the plugin by checking the related file attribute.
This may not be available in each possible scenario, as e.g. the code may exist in memory only.

Suggested solution:
Implement a fallback mechanism, if file is not available. Like:

if hasattribute(sys.modules[self.__module__], "__file__"):
   self.path = sys.modules[self.__module__].__file__
else:
   self.path = ""

Error:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions