Hi,
After I upgrade from V115 to V117, I realize V117 breaks my python script with urllib library.
When I re-write the V115 image, the python is working again.
Not sure is this a bug or something else?
update:
my apt-get update also breaks after update to V117
Update from V115 to V117 Breaks Python
Re: Update from V115 to V117 Breaks Python
Hi BBmak,bbmak wrote:Hi,
After I upgrade from V115 to V117, I realize V117 breaks my python script with urllib library.
When I re-write the V115 image, the python is working again.
Not sure is this a bug or something else?
update:
my apt-get update also breaks after update to V117
When you say "breaks your python script and apt-get update", please could you provide us with more information. Either a screenshot of the error/issue when it occurs, or a copy and paste over SSH.
With the requested information above, we should be able to assist you

If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: Update from V115 to V117 Breaks Python
Sure, Thank you for the reply. Here is the output of one of the scripts that I am using to update the noip ddns.
Another script using urllibTraceback (most recent call last):
File "noip.py", line 7, in <module>
web_page = urllib.urlopen("http://iptools.bizhat.com/ipv4.php")
File "/usr/lib/python2.7/urllib.py", line 87, in urlopen
return opener.open(url)
File "/usr/lib/python2.7/urllib.py", line 213, in open
return getattr(self, name)(url)
File "/usr/lib/python2.7/urllib.py", line 350, in open_http
h.endheaders(data)
File "/usr/lib/python2.7/httplib.py", line 997, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 850, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 812, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 793, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
IOError: [Errno socket error] [Errno -2] Name or service not known
Traceback (most recent call last):
File "afraid.py", line 20, in <module>
newip = urllib2.urlopen("http://ip.dnsexit.com/").read().strip()
File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
Re: Update from V115 to V117 Breaks Python
Might be related to the recent proxy support in DietPi.
As per this page, please try:
You might need to:
As per this page, please try:
Failing that, try running the script with python 3:Ok, doing os.environ['http_proxy']='' before importing urllib2 seems
to do the trick for that.
Code: Select all
python3 myscript.py
Code: Select all
apt-get install python3
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: Update from V115 to V117 Breaks Python
I tried your suggestions, python3 seems working, but I have to change a lot of my codes in order to make my scripts work in python3.Fourdee wrote:Might be related to the recent proxy support in DietPi.
As per this page, please try:Failing that, try running the script with python 3:Ok, doing os.environ['http_proxy']='' before importing urllib2 seems
to do the trick for that.You might need to:Code: Select all
python3 myscript.py
Code: Select all
apt-get install python3
When I use os.environ['http_proxy']='' before importing urllib2, i got the same output as previous.
using V117 also break my apt-get update. It throws me an error as well.
Re: Update from V115 to V117 Breaks Python
Strange. Is it possible the urllib2 library you have is only python3 compatible?bbmak wrote:I tried your suggestions, python3 seems working, but I have to change a lot of my codes in order to make my scripts work in python3.
When I use os.environ['http_proxy']='' before importing urllib2, i got the same output as previous.
using V117 also break my apt-get update. It throws me an error as well.
The apt-get update error, could you paste the error or screenshot it please? There may be a issue with a repo that is causing this. Could even be linked to your python issue if packages were installed from various repos.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: Update from V115 to V117 Breaks Python
Regarding: http://dietpi.com/phpbb/viewtopic.php?f=11&t=408#p1761
Can you paste the results of the following please:
Can you paste the results of the following please:
Code: Select all
cat /etc/apt/sources.list
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: Update from V115 to V117 Breaks Python
Please see image when I perform apt-get update after I updated to V117 from V115.
Re: Update from V115 to V117 Breaks Python
Update: Just realized that ping google.com is not working too, and ping 8.8.8.8 is working.
Re: Update from V115 to V117 Breaks Python
Thanks.bbmak wrote:Update: Just realized that ping google.com is not working too, and ping 8.8.8.8 is working.
Looks like your DNS isnt working correctly.
Can you paste the contents of this file please:
Code: Select all
cat /etc/network/interfaces
And:
Code: Select all
route
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.