473,804 Members | 2,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Where does sys.path get initialized

Hi,

Can anyone tell me where sys.path gets initialized? I know that I can
import sys and then execute sys.path.append (pathname), but I'd prefer
not to have to do that everytime I use PythonWin or Idle. I'm using
Python on both Linux and Windows XP, and I suspect the process is
different for each.

Thanks in advance,
Mike

Jul 18 '05 #1
2 2028
It comes from the value of the PYTHONPATH environment variable, the
location of the script being executed (or the current directory, for an
interactive interpreter), an installation path or paths, and the "site"
module. On Windows, an environment key may be involved, but I am not
aware of any specifics.

http://python.org/doc/lib/module-sys.html#l2h-352
http://python.org/doc/lib/module-site.html

Jeff

Jul 18 '05 #2
mmoum[no-spam-please] wrote:
Hi,

Can anyone tell me where sys.path gets initialized? I know that I can
import sys and then execute sys.path.append (pathname), but I'd prefer
not to have to do that everytime I use PythonWin or Idle. I'm using
Python on both Linux and Windows XP, and I suspect the process is
different for each.

Thanks in advance,
Mike

Consider placing a ".pth" file in your python directory.
This should solve your problems in an easily reversible way.
Jul 18 '05 #3

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

Similar topics

4
2863
by: Alex | last post by:
Rossum's tutorial states "Actually, modules are searched in the list of directories given by the variable sys.path which is initialized from the directory containing the input script (or the current directory)" I'm running Python standard installation (ver 2.4) on Windows XP. Where can I find the "input script" where the sys.path is defined? Alex
23
2842
by: rohit | last post by:
Hi, In my couple of years of experience, I have never found a single instance where I needed to use unions and bitfields(though I have used structures).I was just imagining where would these find relevance.Though both of these(bitfields and unions) are used where space is a constraint(so I can assume always in embedded systems,where memory is particularly less)and we want to save space/memory. As far as I have read, there is no...
13
2131
by: Thomas Zhu | last post by:
Hello, I know the difference between the two definations. But I do not know where are they in the memory. would someone tell me ? char s={"good", "morning"}; // at stack? char *t = {"good", "morning"}; // at heap? thanks in advance.
11
3869
by: fortepianissimo | last post by:
Say I have the following package organization in a system I'm developing: A |----B |----C |----D I have a module, say 'foo', that both package D and B require. What is the best practice in terms of creating a 'common' package that hosts
10
4284
by: Paul Cheetham | last post by:
Hi, I am developing an application that needs to store some machine-specific settings. The application is going to be published on the network in order to keep the clients on the latest version. Because of this, I am unable to store these settings in the App.Config file, as this gets updated every time the application does, and there doesn't appear to be a way of preventing this. Most of my application settings are kept in the...
2
4789
by: Daniel Mark | last post by:
Hello all: I installed IPython on my XP machine today and find that my sys.path has been changed as follows:
43
5216
by: Kislay | last post by:
Which of the following is correct regarding the storage of global variables : 1. Global variables exist in a memory area that exists from before the first reference in a program until after the last reference . 2.Global variables exist in the initialized data segment .
9
2110
by: raashid bhatt | last post by:
does having more variables increases the size of program.
45
2060
by: Bob Altman | last post by:
This code (Visual Studio 2005) should generate a compilation warning to the effect that I'm accessing a shared member through an instance variable (the "color" variable): Private Sub X(ByVal color As Color) Me.BackColor = color.AliceBlue End Sub On *some* computers this produces the expected warning. On others it does not. Any clue what setting is causing some computers to fail to complain?
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10354
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10101
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.