1 Replies - 685 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: 41
  • 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:\\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.


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!


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: 46
  • View blog
  • Posts: 171
  • 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