473,671 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python Path Dictionary

Hi,

Do the Python Paths come in the form of a dictionary where I can
access a particular path my its key in the registry?

For example, in PythonWin Tools>>Edit Python Paths shows the name as
well of the address of each path

Thanks,

Aine

Aug 21 '07 #1
4 1996
ai********@yaho o.com wrote:
Hi,

Do the Python Paths come in the form of a dictionary where I can
access a particular path my its key in the registry?

For example, in PythonWin Tools>>Edit Python Paths shows the name as
well of the address of each path

Thanks,

Aine

If by "Python Paths" you mean the list of directories searched when
doing an import, then it is a list (not a dictionary and you can access
it as sys.path.

Here it is on both my Linux and Windows systems:
>>import sys
sys.path
['', '/usr/lib/portage/pym', '/usr/lib/python25.zip',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2',
'/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload',
'/usr/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages/Numeric',
'/usr/lib/python2.5/site-packages/PIL',
'/usr/lib/python2.5/site-packages/gtk-2.0']
>>import sys
sys.path
['', 'C:\\WINDOWS\\s ystem32\\python 24.zip', 'C:\\cygwin\\ho me\\Gary',
'c:\\python24\\ DLLs', 'c:\\python24\\ lib',
'c:\\python24\\ lib\\plat-win', 'c:\\python24\\ lib\\lib-tk',
'c:\\python24', 'c:\\python24\\ lib\\site-packages',
'c:\\python24\\ lib\\site-packages\\Numer ic',
'c:\\python24\\ lib\\site-packages\\PIL',
'c:\\python24\\ lib\\site-packages\\gtk-2.0',
'c:\\python24\\ lib\\site-packages\\win32 ',
'c:\\python24\\ lib\\site-packages\\win32 \\lib',
'c:\\python24\\ lib\\site-packages\\Pytho nwin']
Aug 21 '07 #2
On 21 Aug, 17:42, Gary Herron <gher...@island training.comwro te:
aine_ca...@yaho o.com wrote:
Hi,
Do the Python Paths come in the form of a dictionary where I can
access a particular path my its key in the registry?
For example, in PythonWin Tools>>Edit Python Paths shows the name as
well of the address of each path
Thanks,
Aine

If by "Python Paths" you mean the list of directories searched when
doing an import, then it is a list (not a dictionary and you can access
it as sys.path.

Here it is on both my Linux and Windows systems:
>import sys
sys.path

['', '/usr/lib/portage/pym', '/usr/lib/python25.zip',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2',
'/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload',
'/usr/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages/Numeric',
'/usr/lib/python2.5/site-packages/PIL',
'/usr/lib/python2.5/site-packages/gtk-2.0']
>import sys
sys.path

['', 'C:\\WINDOWS\\s ystem32\\python 24.zip', 'C:\\cygwin\\ho me\\Gary',
'c:\\python24\\ DLLs', 'c:\\python24\\ lib',
'c:\\python24\\ lib\\plat-win', 'c:\\python24\\ lib\\lib-tk',
'c:\\python24', 'c:\\python24\\ lib\\site-packages',
'c:\\python24\\ lib\\site-packages\\Numer ic',
'c:\\python24\\ lib\\site-packages\\PIL',
'c:\\python24\\ lib\\site-packages\\gtk-2.0',
'c:\\python24\\ lib\\site-packages\\win32 ',
'c:\\python24\\ lib\\site-packages\\win32 \\lib',
'c:\\python24\\ lib\\site-packages\\Pytho nwin']
Thanks.

Yeah, that's exactly what I'm talking about, but I don't want the
list, I want to access a certain path by name. I'm guessing I'm going
to have to write a function to do this that reads the value from the
registry.

Aug 21 '07 #3
On 8/21/07, ai********@yaho o.com <ai********@yah oo.comwrote:
On 21 Aug, 17:42, Gary Herron <gher...@island training.comwro te:
aine_ca...@yaho o.com wrote:
Hi,
Do the Python Paths come in the form of a dictionary where I can
access a particular path my its key in the registry?
For example, in PythonWin Tools>>Edit Python Paths shows the name as
well of the address of each path
Thanks,
Aine
If by "Python Paths" you mean the list of directories searched when
doing an import, then it is a list (not a dictionary and you can access
it as sys.path.

Here it is on both my Linux and Windows systems:
>>import sys
>>sys.path
['', '/usr/lib/portage/pym', '/usr/lib/python25.zip',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2',
'/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload',
'/usr/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages/Numeric',
'/usr/lib/python2.5/site-packages/PIL',
'/usr/lib/python2.5/site-packages/gtk-2.0']
>>import sys
>>sys.path
['', 'C:\\WINDOWS\\s ystem32\\python 24.zip', 'C:\\cygwin\\ho me\\Gary',
'c:\\python24\\ DLLs', 'c:\\python24\\ lib',
'c:\\python24\\ lib\\plat-win', 'c:\\python24\\ lib\\lib-tk',
'c:\\python24', 'c:\\python24\\ lib\\site-packages',
'c:\\python24\\ lib\\site-packages\\Numer ic',
'c:\\python24\\ lib\\site-packages\\PIL',
'c:\\python24\\ lib\\site-packages\\gtk-2.0',
'c:\\python24\\ lib\\site-packages\\win32 ',
'c:\\python24\\ lib\\site-packages\\win32 \\lib',
'c:\\python24\\ lib\\site-packages\\Pytho nwin']

Thanks.

Yeah, that's exactly what I'm talking about, but I don't want the
list, I want to access a certain path by name. I'm guessing I'm going
to have to write a function to do this that reads the value from the
registry.
The elements of the path don't have names - they are a list of
directories. You are mistaking Pythonwins configuration options (like
where it searches for modules) for the python path.

Note that the registry entry "PythonPath " (which is not respected by
Python, but used by Pythonwin to override the default python path) is
a semi-colon separated list, not a series of keys.
Aug 21 '07 #4
On 21 Aug, 21:45, "Chris Mellon" <arka...@gmail. comwrote:
On 8/21/07, aine_ca...@yaho o.com <aine_ca...@yah oo.comwrote:


On 21 Aug, 17:42, Gary Herron <gher...@island training.comwro te:
aine_ca...@yaho o.com wrote:
Hi,
Do the Python Paths come in the form of a dictionary where I can
access a particular path my its key in the registry?
For example, in PythonWin Tools>>Edit Python Paths shows the name as
well of the address of each path
Thanks,
Aine
If by "Python Paths" you mean the list of directories searched when
doing an import, then it is a list (not a dictionary and you can access
it as sys.path.
Here it is on both my Linux and Windows systems:
>import sys
>sys.path
['', '/usr/lib/portage/pym', '/usr/lib/python25.zip',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2',
'/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload',
'/usr/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages/Numeric',
'/usr/lib/python2.5/site-packages/PIL',
'/usr/lib/python2.5/site-packages/gtk-2.0']
>import sys
>sys.path
['', 'C:\\WINDOWS\\s ystem32\\python 24.zip', 'C:\\cygwin\\ho me\\Gary',
'c:\\python24\\ DLLs', 'c:\\python24\\ lib',
'c:\\python24\\ lib\\plat-win', 'c:\\python24\\ lib\\lib-tk',
'c:\\python24', 'c:\\python24\\ lib\\site-packages',
'c:\\python24\\ lib\\site-packages\\Numer ic',
'c:\\python24\\ lib\\site-packages\\PIL',
'c:\\python24\\ lib\\site-packages\\gtk-2.0',
'c:\\python24\\ lib\\site-packages\\win32 ',
'c:\\python24\\ lib\\site-packages\\win32 \\lib',
'c:\\python24\\ lib\\site-packages\\Pytho nwin']
Thanks.
Yeah, that's exactly what I'm talking about, but I don't want the
list, I want to access a certain path by name. I'm guessing I'm going
to have to write a function to do this that reads the value from the
registry.

The elements of the path don't have names - they are a list of
directories. You are mistaking Pythonwins configuration options (like
where it searches for modules) for the python path.

Note that the registry entry "PythonPath " (which is not respected by
Python, but used by Pythonwin to override the default python path) is
a semi-colon separated list, not a series of keys.- Dölj citerad text -

- Visa citerad text -
Your right with regard to Python Win! Although, it can be both a semi-
colon seperated list and/or a set of keys. On my PC I have a default
key under python paths (with a list of paths), plus a set of keys with
their own individul paths. I can therefore install my python code in
any directory and manipulate these keys to find the modules I need.

Aug 22 '07 #5

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

Similar topics

1
2569
by: M.E.Farmer | last post by:
Hello c.l.py!, I have just finished this and decided to share. PySourceColor is a module to convert Python source into colored html. Yes it has been done before, but I like this better:) You can easily define your own colorscheme. example usage: # Highlight PySourceColor.py python PySourceColor.py or # Show help
10
3681
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. Andrew dalke@dalkescientific.com
5
2650
by: EP | last post by:
This inquiry may either turn out to be about the suitability of the SHA-1 (160 bit digest) for file identification, the sha function in Python ... or about some error in my script. Any insight appreciated in advance. I am trying to reduce duplicate files in storage at home - I have a large number files (e.g. MP3s) which have been stored on disk multiple times under different names or on different paths. The using applications will...
0
4555
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 349 open ( +7) / 3737 closed (+25) / 4086 total (+32) Bugs : 939 open (-12) / 6648 closed (+60) / 7587 total (+48) RFE : 249 open ( -8) / 278 closed (+12) / 527 total ( +4) New / Reopened Patches ______________________
0
2568
by: Joe Goldthwaite | last post by:
Thanks Guilherme. That helped. I guess I was thinking that pysqlite would automatically come with some version of sqlite. The fact that it doesn't is what was causing me to get the strange results. I downloaded the Windows version of the SQLite3.dll. I didn't know where to put it so I first put it in its own directory and tried to register it. That didn't work so I just moved it to the pysqlite directory in site-packages. That did...
0
8483
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
8824
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
8603
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
8673
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...
1
6236
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
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
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2818
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
1815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.