473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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

Sep 18 '07 #1
1 1143
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

Sep 19 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Wichterich | last post by:
Hello Pythonistas, I am trying to get certain (self-written) libraries imported into my scripts using statements like "from library import function.py". But they are not being found. I...
4
by: r.e.s. | last post by:
I have no PYTHONPATH nor any other python-related environment variables, yet everything seems fine. (I'm using PythonWin with winxp.) As long as modules are loaded through PythonWin, is...
8
by: Tero Pihlajakoski | last post by:
Hi, I've been experimenting on embedding Python to a C software, and ran into a little problem with PYTHONPATH (I'm running on linux). Here's the deal: When trying to call...
10
by: sushant.sirsikar | last post by:
Hi, I am using Linux env.I set the PYTHONPATH using import sys sys.path.append(----) But we i close python and start again i is not showing my new entry in PYTHONPATH. Can anyone help me to...
0
by: Michael Yanowitz | last post by:
Hello: Someone on my team tried out installing my Python code and found that setting PYTHONPATH does not work, but setting PATH environment variable works the way PYTHONPATH should. Is that how...
17
by: mohan | last post by:
Hi Guys, I've been using the following IDE, "Pythonwin - Python IDE and GUI Framework for Windows. Copyright 1994-2001 Mark Hammond " With respect to my work, I had created my own modules...
12
by: Jack | last post by:
Since the full installation of Python (from either the standard installer or ActiveState installer) is too big for my intended use, I'd like to build a custom distribution of Python for Windows...
8
by: Stef Mientki | last post by:
hello, after cleaning up a PC, Python can't find any libraries anymore. But happily I've still one PC, where Python is running perfect. Now I always read about the environment variable...
4
by: mhearne808[insert-at-sign-here]gmail[insert-dot-he | last post by:
I'm missing something major here. I'm trying to add a directory to my python path using the PYTHONPATH environment variable, and it's being ignored by the Python interactive shell. Below is a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.