Skip to content
This repository was archived by the owner on Jan 6, 2021. It is now read-only.
This repository was archived by the owner on Jan 6, 2021. It is now read-only.

modules input #16

Open
Open

Activity

  1. piac commented on Sep 1, 2011

    @piac
    MemberAuthor

    It is and will always be possible to add paths manually with this syntax:

    import sys
    if not my_path in sys.path:
    sys.path.append(my_path)

    import my_library

  2. bengolder commented on Mar 4, 2012

    @bengolder

    I think this is most relevant to new users and to people who want to create and share plugins.

    new users, who are trying to use some neat python library they found, would benefit from a simple non-code interface for adding python modules to import from. If there was an option to right click, then select a folder to add to the sys.path, I think using external modules would be less intimidating to a brand new user.

    The second use case is script authors who want to share a script that relies on additional modules. this might be well addressed in several ways:

    1. if the menu described above recorded file paths relative to the grasshopper file in which the script is saved.
    2. if there is a very clear default file path for scripting components to utilize that will always be included in sys.path (perhaps the 'Components Folder', or a 'Scripts' folder, or the 'User Object' folder.) This way, there is little confusion about where additional packages should be placed. Imagine downloading someone's script and they can say "To get started, just drag and drop this .gh file into your 'Scripts Folder' which can be found under 'File' > 'Special Folder' in Grasshopper."
  3. piac commented on Oct 23, 2013

    @piac
    MemberAuthor

    I think I would need some interventions in the main Rhino.Python plugin for this, as the ghPython component is, among other things, a trimmed-down version of the same editor that is there in _EditPythonScript. This actually means that

    1. There is already a non-coding way to do that. It is in the _EditPythonScript. In fact, the ghPython component listens to all the locations that are available in _EditPythonScript > Options > Module Search Paths. What is missing is probably a way to show that information in ghPython for convenience. I am only afraid about adding several location, as it will slow down the search for modules.
    2. The local Grasshopper file path is, from now (0.5.99) on, available in sys.path, while running the ghPython component definition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions