Custom PYTHONPATH not being seen by -m - Python

This is a discussion on Custom PYTHONPATH not being seen by -m - Python ; Hello, I am running RHEL5, with Python 2.4.3. I do not experience this problem on my other machines, which are 2.5. The following should demonstrate my issue: [16:38][vince:~]$ python -m srctools.symbol_replace -h python: module srctools.symbol_replace not found [16:40][vince:~]$ python Python ...

+ Reply to Thread
Results 1 to 2 of 2

Custom PYTHONPATH not being seen by -m

  1. Default Custom PYTHONPATH not being seen by -m

    Hello,

    I am running RHEL5, with Python 2.4.3. I do not experience this
    problem on my other machines, which are 2.5.

    The following should demonstrate my issue:

    [16:38][vince:~]$ python -m srctools.symbol_replace -h
    python: module srctools.symbol_replace not found
    [16:40][vince:~]$ python
    Python 2.4.3 (#1, Dec 11 2006, 11:38:52)
    [GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import srctools.symbol_replace
    >>> srctools.symbol_replace

    <module 'srctools.symbol_replace' from '/usr/local/pymodules/srctools/
    symbol_replace.py'>
    >>>

    [16:41][vince:~]$ echo $PYTHONPATH
    /usr/local/pymodules


    Thank you,
    Vince


  2. Default Re: Custom PYTHONPATH not being seen by -m

    Vince Castellano wrote:
    > Hello,
    >
    > I am running RHEL5, with Python 2.4.3. I do not experience this
    > problem on my other machines, which are 2.5.
    >
    > The following should demonstrate my issue:
    >
    > [16:38][vince:~]$ python -m srctools.symbol_replace -h
    > python: module srctools.symbol_replace not found
    > [16:40][vince:~]$ python
    > Python 2.4.3 (#1, Dec 11 2006, 11:38:52)
    > [GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
    > Type "help", "copyright", "credits" or "license" for more information.
    >>>> import srctools.symbol_replace
    >>>> srctools.symbol_replace

    > <module 'srctools.symbol_replace' from '/usr/local/pymodules/srctools/
    > symbol_replace.py'>
    > [16:41][vince:~]$ echo $PYTHONPATH
    > /usr/local/pymodules
    >

    I suspect if you read "What's new in Python 2.5" you will find that the
    semantics of the -m option changed between the two releases. Let me see
    .... right, here it is:

    """
    The -m switch added in Python 2.4 to execute a module as a script gained
    a few more abilities. Instead of being implemented in C code inside the
    Python interpreter, the switch now uses an implementation in a new
    module, runpy.

    The runpy module implements a more sophisticated import mechanism so
    that it's now possible to run modules in a package such as
    pychecker.checker. The module also supports alternative import
    mechanisms such as the zipimport module. This means you can add a .zip
    archive's path to sys.path and then use the -m switch to execute code
    from the archive.
    """

    (from http://docs.python.org/whatsnew/pep-338.html).

    In other words, 2.4 specifically didn't allow the command line import of
    package submodules.

    regards
    Steve
    --
    Steve Holden +1 571 484 6266 +1 800 494 3119
    Holden Web LLC/Ltd http://www.holdenweb.com
    Skype: holdenweb http://del.icio.us/steve.holden

    Sorry, the dog ate my .sigline


+ Reply to Thread

Similar Threads

  1. PYTHONPATH and PYTHON_PATH
    By Application Development in forum Python
    Replies: 1
    Last Post: 12-04-2007, 07:54 AM
  2. PYTHONPATH on OS X
    By Application Development in forum Python
    Replies: 4
    Last Post: 10-11-2007, 09:52 AM
  3. PYTHONPATH, opensuse10.2, gtk not working
    By Application Development in forum Python
    Replies: 4
    Last Post: 10-05-2007, 03:15 PM
  4. PYTHONPATH not working on Windows XP (?)
    By Application Development in forum Python
    Replies: 2
    Last Post: 09-03-2007, 02:58 AM
  5. PATH or PYTHONPATH under Windows ???
    By Application Development in forum Python
    Replies: 8
    Last Post: 06-06-2007, 09:03 AM