[wxPython-users] sys.path adjusted?

Jorgen Bodde jorgen.maillist at gmail.com
Mon Nov 12 00:28:09 PST 2007


Hi Patrick,

That's what I did now, I am not a python veteran, so you might be
right. However I have not seen sys.path[0] change since I used
wxWidgets. It looked odd that I would have to resort to putting code
at the very beginning of my module to grab sys.path before it gets
changed. But you might be right, if it is an unwritten rule that the
insert should go at the beginning (beats me why) then I will keep this
construction.

Regards,
- Jorgen

On Nov 11, 2007 5:18 PM, Patrick K. O'Brien <pobrien at orbtech.com> wrote:
> On Nov 11, 2007, at 9:28 AM, Karsten Hilbert wrote:
>
> >>> You might read and save away sys.path[0] as the very
> >>> first thing in your main script.
> >>
> >> That is what I am doing now, but for me it is an unnessecary
> >> workaround if wxversion would not intrude the sys.path[0] location.
> > Well, if it's not wxversion (which you may well get "fixed")
> > it's bound to be something other than that. It's gonna bite
> > when you least expect it. So being the xplatform person
> > often requires being the paranoid person.
>
> I agree with Karsten on this point.  If you want a clean sys.path[0]
> then you need to capture it at the beginning of your own code.  Any
> imported module can change sys.path and the most common change that
> I've seen (or implemented) is to insert something at the beginning.
>
> >> Somewhere in the docs I've read that you should always append when
> >> adding search paths.
> > While that's surely sane advice in most situations it will
> > not apply in all:
>
> I don't recall seeing this in the docs and the times I've munged
> sys.path it has been to add something to the very beginning.  The
> convention you are citing is one that I don't see being followed.  So
> the burden is on you to get what you need from sys.path.  :-)
>
> --
> Patrick K. O'Brien
> Orbtech    http://www.orbtech.com
> Schevo     http://www.schevo.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>




More information about the wxpython-users mailing list