Discussion:
Message to Robin Dunn
Boštjan Mejak
2013-03-18 15:01:58 UTC
Permalink
Hello Robin,
you have suggested I patch Phoenix/wx/lib/softwareupdate.py when I encountered an error on importing softwareupdate on Python 3. The error was that softwareupdate uses urllib2 to perform Internet-related tasks. You suggested the six module to patch softwareupdate, but the six docs say that urllib and urllib2 aren't supported. So that's gonna be a burden. Are you going to look at this and patch it?
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Cody
2013-03-18 15:13:53 UTC
Permalink
Hi,
Post by Boštjan Mejak
Hello Robin,
you have suggested I patch Phoenix/wx/lib/softwareupdate.py when I
encountered an error on importing softwareupdate on Python 3. The error was
that softwareupdate uses urllib2 to perform Internet-related tasks. You
suggested the six module to patch softwareupdate, but the six docs say that
urllib and urllib2 aren't supported. So that's gonna be a burden. Are you
going to look at this and patch it?
urllib2 was merged into the urllib module in Python 3. So when running on
python 3 you would import and use urllib instead of urllib2.

Depending upon what features are used by the update module some additional
changes may be needed (see notes:
http://docs.python.org/2/library/urllib2.html). So guess the story is
either do some homework or be patient and wait till someone else gets to it
;).


Cody
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Werner
2013-03-18 15:21:15 UTC
Permalink
Hi,
Post by Boštjan Mejak
Hello Robin,
you have suggested I patch Phoenix/wx/lib/softwareupdate.py when I encountered an error on importing softwareupdate on Python 3. The error was that softwareupdate uses urllib2 to perform Internet-related tasks. You suggested the six module to patch softwareupdate, but the six docs say that urllib and urllib2 aren't supported. So that's gonna be a burden. Are you going to look at this and patch it?
Maybe instead of using the six module just have conditional imports.

Pseudo:
if py2:
from urllib2 import urlopen
if py3:
from urllib.request import urlopen

and the same for URLError and then change the code where these are used.

Werner

http://docs.python.org/3/library/urllib.request.html#module-urllib.request
http://docs.python.org/3.3/library/2to3.html?highlight=urllib#urllib

http://docs.python.org/2/library/urllib2.html
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Boštjan Mejak
2013-03-18 16:55:26 UTC
Permalink
I found a solution to this problem...
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen

The six module does not handle urllib and urllib2, so this is a temporary solution. Anyone has any other idea?
-----Original message-----
From: Cody
Sent: 18.03.2013, 16:13
To: wxpython-***@googlegroups.com
Subject: Re: [wxPython-users] Message to Robin Dunn


Hi,
Post by Boštjan Mejak
Hello Robin,
you have suggested I patch Phoenix/wx/lib/softwareupdate.py when I
encountered an error on importing softwareupdate on Python 3. The error was
that softwareupdate uses urllib2 to perform Internet-related tasks. You
suggested the six module to patch softwareupdate, but the six docs say that
urllib and urllib2 aren't supported. So that's gonna be a burden. Are you
going to look at this and patch it?
urllib2 was merged into the urllib module in Python 3. So when running on
python 3 you would import and use urllib instead of urllib2.

Depending upon what features are used by the update module some additional
changes may be needed (see notes:
http://docs.python.org/2/library/urllib2.html). So guess the story is
either do some homework or be patient and wait till someone else gets to it
;).


Cody
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Robin Dunn
2013-03-18 19:22:37 UTC
Permalink
Post by Boštjan Mejak
I found a solution to this problem...
from urllib2 import urlopen
from urllib.request import urlopen
The six module does not handle urllib and urllib2, so this is a temporary solution. Anyone has any other idea?
That is one correct way to do it. Another correct way would be to use
six.PY3

if six.PY3:
from urllib.request import urlopen
else:
from urllib2 import urlopen
--
Robin Dunn
Software Craftsman
http://wxPython.org
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Andrea Gavana
2013-03-18 19:23:46 UTC
Permalink
Post by Boštjan Mejak
I found a solution to this problem...
from urllib2 import urlopen
from urllib.request import urlopen
The six module does not handle urllib and urllib2, so this is a temporary solution. Anyone has any other idea?
Maybe something like this (no error catching):

import wx.lib.six as six

if six.PY3:
from urllib.request import urlopen
else:
from urllib2 import urlopen
Post by Boštjan Mejak
-----Original message-----
From: Cody
Sent: 18.03.2013, 16:13
Subject: Re: [wxPython-users] Message to Robin Dunn
Hi,
Post by Boštjan Mejak
Hello Robin,
you have suggested I patch Phoenix/wx/lib/softwareupdate.py when I
encountered an error on importing softwareupdate on Python 3. The error was
that softwareupdate uses urllib2 to perform Internet-related tasks. You
suggested the six module to patch softwareupdate, but the six docs say that
urllib and urllib2 aren't supported. So that's gonna be a burden. Are you
going to look at this and patch it?
urllib2 was merged into the urllib module in Python 3. So when running on
python 3 you would import and use urllib instead of urllib2.
Depending upon what features are used by the update module some additional
http://docs.python.org/2/library/urllib2.html). So guess the story is
either do some homework or be patient and wait till someone else gets to it
;).
Cody
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
For more options, visit https://groups.google.com/groups/opt_out.
--
Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://www.infinity77.net

# ------------------------------------------------------------- #
def ask_mailing_list_support(email):

if mention_platform_and_version() and include_sample_app():
send_message(email)
else:
install_malware()
erase_hard_drives()
# ------------------------------------------------------------- #
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Boštjan Mejak
2013-03-18 21:28:43 UTC
Permalink
Thanks for your replies, Robin and Andrea. Would you mind telling me what
the Phoenix/wx/lib/softwareupdate.py is actually for? And if it's not too
important keeping it around, we can remove it from future Phoenix source
code. What do you say about that?
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Robin Dunn
2013-03-19 00:56:30 UTC
Permalink
Post by Boštjan Mejak
Thanks for your replies, Robin and Andrea. Would you mind telling me
what the Phoenix/wx/lib/softwareupdate.py is actually for?
Did you even think about reading the comments and the docstring in the
module so you could answer that question for yourself?

If you don't even know what it is, why are you so worried about it? If
you don't need it then don't import it in your code.
Post by Boštjan Mejak
And if it's
not too important keeping it around, we can remove it from future
Phoenix source code. What do you say about that?
No.
--
Robin Dunn
Software Craftsman
http://wxPython.org
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Continue reading on narkive:
Loading...