I have just discovered the wxversion module. Am I right in thinking that every distributed wxPython application should be using it? If I understand correctly, any user of a wxPython application who has multiple versions of wxPython installed is at major risk of problems if the application doesn't specify the particular version it needs.
The weirdness I refer to relates to sys.path. If I do the following:
Is that deliberate? What it means is that I can't just get the working path from sys.path[1]. I have a simple workaround but it still seems a little weird.
I have just discovered the wxversion module. Am I right in thinking that every distributed wxPython application should be using it? If I understand correctly, any user of a wxPython application who has multiple versions of wxPython installed is at major risk
"major risk" - what do you see as a major risk here? In my view it is up to the application developer to ensure the correct version of any library needed by his application. If you distribute in source then with wxPython you would use wxversion to ensure the correct version or throw an error if nothing "usable" is the users machine. If you distribute in .exe format then you ensure the right version when you do the build.
of problems if the application doesn't specify the particular version it needs.
The weirdness I refer to relates to sys.path. If I do the following:
I have just discovered the wxversion module. Am I right in thinking that
every distributed wxPython application should be using it? If I
understand correctly, any user of a wxPython application who has
multiple versions of wxPython installed is at major risk of problems if
the application doesn't specify the particular version it needs.
The weirdness I refer to relates to sys.path. If I do the following:
wxversion just attempts to insert an item in the sys.path such that the selected version of wxPython will be found first. It does not remove others that may already be there because of .pth files, PYTHONPATH, or whatever.
What it means is that I can't just get the working
path from sys.path[1]. I have a simple workaround but it still seems a
little weird.
As mentioned already, wx.__file__ would be the right way to know which one was actually imported.
Thanks for the explanation of what wxversion is actually doing.
As for my comment on knowing which path the script is in, I am
referring to the script I am running, not the wx script. Nice to know
about wx.__file__ though.
BTW the reason I use sys.path to work out the current location instead
of __file__ is because it works even within an interpreter like IDLE.
I needed this to be the case because sometimes people want to run a
faulty script from within IDLE to debug it. I wouldn't be surprised
if there are better solutions but what I currently do works (after a
fashion).
···
On Mar 27, 1:47 pm, Robin Dunn <ro...@alldunn.com> wrote:
On 3/26/10 12:17 AM, Grant Paton-Simpson wrote:
> Hi,
> I have just discovered the wxversion module. Am I right in thinking that
> every distributed wxPython application should be using it? If I
> understand correctly, any user of a wxPython application who has
> multiple versions of wxPython installed is at major risk of problems if
> the application doesn't specify the particular version it needs.
> The weirdness I refer to relates to sys.path. If I do the following:
wxversion just attempts to insert an item in the sys.path such that the
selected version of wxPython will be found first. It does not remove
others that may already be there because of .pth files, PYTHONPATH, or
whatever.
> What it means is that I can't just get the working
> path from sys.path[1]. I have a simple workaround but it still seems a
> little weird.
As mentioned already, wx.__file__ would be the right way to know which
one was actually imported.
--
Robin Dunn
Software Craftsmanhttp://wxPython.org