#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    Chicago
    Posts
    17
    Rep Power
    0

    Additional Modules for Client API


    Hey Guys,
    I am trying to deploy the API for TACTIC (asset management software), reading the manual, where documentation suggests to place the CLIENT api folder in a shared location on the network.
    The CLIENT folder consist "*.py" files (modules) that are later being used for the programming part.

    I followed instructions in both, the API doc and Pythiong Doc, where i am required to add ENVIRONMENTAL PATH to PYTHON as well as include the location of my SHARED folders.

    When i run:
    Code:
    Python Code:
    import sys
    sys.path
    In output i can see my PATH that links to custom network location as well as additional standard Python libs/modules.

    Back to my IDLE editor:

    Code:
    Python Code:
    >>> from tactic_client_lib import TacticServerStub
     
    Traceback (most recent call last):
      File "<pyshell#4>", line 1, in <module>
        from tactic_client_lib import TacticServerStub
    ImportError: No module named tactic_client_lib
    Could you suggest the way out? to get things working?

    Thanks in advance!
    -stas
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    39N 104.28W
    Posts
    158
    Rep Power
    3
    Originally Posted by stascrash
    Hey Guys,
    I am trying to deploy the API for TACTIC (asset management software), reading the manual, where documentation suggests to place the CLIENT api folder in a shared location on the network.
    The CLIENT folder consist "*.py" files (modules) that are later being used for the programming part.

    I followed instructions in both, the API doc and Pythiong Doc, where i am required to add ENVIRONMENTAL PATH to PYTHON as well as include the location of my SHARED folders.

    When i run:
    Code:
    Python Code:
    import sys
    sys.path
    In output i can see my PATH that links to custom network location as well as additional standard Python libs/modules.

    Back to my IDLE editor:

    Code:
    Python Code:
    >>> from tactic_client_lib import TacticServerStub
     
    Traceback (most recent call last):
      File "<pyshell#4>", line 1, in <module>
        from tactic_client_lib import TacticServerStub
    ImportError: No module named tactic_client_lib
    Could you suggest the way out? to get things working?

    Thanks in advance!
    -stas
    You need to append the path where the modules reside to the sys.path list. See here http://docs.python.org/2/reference/s...port-statement
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    Chicago
    Posts
    17
    Rep Power
    0
    Thanks rrashkin,
    I tried that and looks like it works perfectly.
    The question now is this :
    if other clients (users) will have to access and execute this same script, their workstations does not have modified Python, what would be the most efficient way of updating their SYS path to look in a proper shared space?

    This is one of the main reasons, if i am correct, that my API suggests to run via PYTHONPATH.

    Thoughts?
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    39N 104.28W
    Posts
    158
    Rep Power
    3
    Just include the "sys.path.append("/blah/blah/blah") in the script, itself.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    Chicago
    Posts
    17
    Rep Power
    0
    Ok, it works the way i was expecting it. Great. Thank you!

IMN logo majestic logo threadwatch logo seochat tools logo