1 Replies - 241 Views - Last Post: 10 January 2013 - 09:49 PM Rate Topic: -----

#1 Sami_codes_AllDay  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 37
  • Joined: 09-August 11

Permanent Deletions from sys.path

Posted 08 January 2013 - 07:34 PM

Hello Good People,

I'm fairly new to Python (v 2.7.3) and having an issue with a duplicate path when I perform a "sys.path" within the interactive interpreter.


>>> import os
>>> import sys
>>>
>>> sys.path

'', 'C:\\Python27\\Lib\\idlelib', 
 'C:\\WINDOWS\\system32', 
 'C:\\Python27\\Lib\\site-packages\\win32', 
 'C:\\Python27',
 'C:\\windows\\system32\\python27.zip', 
 'C:\\Python27\\DLLs', 
 'C:\\Python27\\lib', 
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk', 
 'C:\\Python27\\lib\\site-packages',	 <---- This is the problem, you have duplicates
 'C:\\Python27\\lib\\site-packages',     <---- This is the problem, you have duplicates




I know that I can hackily and temporarily delete one of the list elements by performing a "sys.path.pop(10)", but that's just a bandaid.

Is there a way to 1) Utilize a function that can traverse the path of where each element of sys.path is finding the list of elements. I need a function that will act as a bloodhound and track these elements' roots down.

and

2) Permanently delete that duplicate list element.

Lastly, in case you were wondering, here are the contents of my PYTHONPATH variable: "C:\WINDOWS\system32;C:\Python27\Lib\site-packages\win32"

Ideas Are Highly Valued & Appreciated!

Sami

This post has been edited by macosxnerd101: 08 January 2013 - 07:43 PM
Reason for edit:: Fixed code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Permanent Deletions from sys.path

#2 woooee  Icon User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 68
  • Joined: 21-November 12

Re: Permanent Deletions from sys.path

Posted 10 January 2013 - 09:49 PM

On Linux, and probably Windows as well, the default path is done by the site.py program. You could start there.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1