Loading ...
Sorry, an error occurred while loading the content.

Python Path for Unslung 5.5?

Expand Messages
  • Airw0lf
    Hi, I just installed the python package via ipkg install, and I am trying to run some python programs. In one library, the documentation makes mention of a
    Message 1 of 5 , Mar 10, 2006
    • 0 Attachment
      Hi,

      I just installed the python package via ipkg install, and I am trying to
      run some python programs.

      In one library, the documentation makes mention of a "python path"
      environment variable. I did a little googling and came up with PYTHONPATH,
      which I exported in my /etc/profile. Am I doing the right thing here -
      'python myapp.py' does not work even though myapp.py is in the folder
      defined by PYTHONPATH.

      Another library makes use of a .pth file, which is somehow meant to point
      to where the .py modules are. At the moment the .pth file is in my
      PYTHONPATH folder. I don't know if it is any good there because python
      doesn't seem to recognise my PYTHONPATH.
    • Robert de Vries
      ... I assume you have set your PATH environment variable to include the directory where the python executable is located. Please check the contents of your
      Message 2 of 5 , Mar 11, 2006
      • 0 Attachment
        On Friday 10 March 2006 11:17, Airw0lf wrote:
        > Hi,
        >
        > I just installed the python package via ipkg install, and I am trying to
        > run some python programs.
        >
        > In one library, the documentation makes mention of a "python path"
        > environment variable. I did a little googling and came up with PYTHONPATH,
        > which I exported in my /etc/profile. Am I doing the right thing here -
        > 'python myapp.py' does not work even though myapp.py is in the folder
        > defined by PYTHONPATH.
        I assume you have set your PATH environment variable to include the directory
        where the python executable is located.
        Please check the contents of your current environment using the command env.
        The description "does not work" is not very precise. Can you provide the
        output when you try to run python myapp.py?

        Robert
      • Airw0lf
        Robert de Vries wrote in ... To elaborate further, the application (myapp.py) is in /root/py. The app depends on pythonutils and
        Message 3 of 5 , Mar 12, 2006
        • 0 Attachment
          Robert de Vries
          <robert.h.de.vries@...> wrote in
          news:200603111316.08075.robert.h.de.vries@...:

          > On Friday 10 March 2006 11:17, Airw0lf wrote:
          >> Hi,
          >>
          >> I just installed the python package via ipkg install, and I am
          >> trying to run some python programs.
          >>
          >> In one library, the documentation makes mention of a "python path"
          >> environment variable. I did a little googling and came up with
          >> PYTHONPATH, which I exported in my /etc/profile. Am I doing the
          >> right thing here - 'python myapp.py' does not work even though
          >> myapp.py is in the folder defined by PYTHONPATH.
          > I assume you have set your PATH environment variable to include the
          > directory where the python executable is located.
          > Please check the contents of your current environment using the
          > command env. The description "does not work" is not very precise. Can
          > you provide the output when you try to run python myapp.py?
          >
          > Robert
          >
          >
          >
          >
          >
          >

          To elaborate further, the application (myapp.py) is in /root/py. The app
          depends on pythonutils and cheetah, which I have placed in subdirectories
          /root/py/pythonutils and /root/py/cheetah.

          When I type 'python myapp.py' in /root/py I get the following error:

          Traceback (most recent call last):
          File "myapp.py", line 15, in ?
          from configobj import ConfigObj, ConfigObjError
          ImportError: No module named configobj

          Now configobj.py is to be found in the /pythonutils subdirectory, but the
          app can't seem to find it. The pythonutils package came with a
          "pythonutils.pth" file, which contains the string "pythonutils". I think
          it has something to do with the path, but I don't know how to use it...

          I assume if pythonutils is not found correctly, I will get the same
          problem with cheetah.

          I get the impression there should be a way to tell Python to search in a
          particular folder for "global" packages (like cheetah and pythonutils),
          but I don't know how. Googling turned up the PYTHONPATH environment
          variable, which I set to /root/py, to no avail. (I get the same error as
          above)
        • Robert de Vries
          ... I would think that you should set PYTHONPATH to /root/py/pythonutils:/root/py/cheetah Robert
          Message 4 of 5 , Mar 13, 2006
          • 0 Attachment
            On Monday 13 March 2006 08:44, Airw0lf wrote:

            >
            > To elaborate further, the application (myapp.py) is in /root/py. The app
            > depends on pythonutils and cheetah, which I have placed in subdirectories
            > /root/py/pythonutils and /root/py/cheetah.
            >
            > When I type 'python myapp.py' in /root/py I get the following error:
            >
            > Traceback (most recent call last):
            >   File "myapp.py", line 15, in ?
            >     from configobj import ConfigObj, ConfigObjError
            > ImportError: No module named configobj
            >
            > Now configobj.py is to be found in the /pythonutils subdirectory, but the
            > app can't seem to find it. The pythonutils package came with a
            > "pythonutils.pth" file, which contains the string "pythonutils". I think
            > it has something to do with the path, but I don't know how to use it...
            >
            > I assume if pythonutils is not found correctly, I will get the same
            > problem with cheetah.
            >
            > I get the impression there should be a way to tell Python to search in a
            > particular folder for "global" packages (like cheetah and pythonutils),
            > but I don't know how. Googling turned up the PYTHONPATH environment
            > variable, which I set to /root/py, to no avail. (I get the same error as
            > above)

            I would think that you should set PYTHONPATH
            to /root/py/pythonutils:/root/py/cheetah

            Robert
          • Airw0lf
            Robert de Vries wrote in ... Thank you for the help, application executes now. My mistake was in expecting python to be able to
            Message 5 of 5 , Mar 14, 2006
            • 0 Attachment
              Robert de Vries
              <robert.h.de.vries@...> wrote in
              news:200603131339.09672.robert.h.de.vries@...:

              > I would think that you should set PYTHONPATH
              > to /root/py/pythonutils:/root/py/cheetah
              >
              > Robert
              >
              >
              >

              Thank you for the help, application executes now. My mistake was in
              expecting python to be able to traverse the subdirectories in /root/py by
              itself... I needed to set the path specifically for both directories.
            Your message has been successfully submitted and would be delivered to recipients shortly.