To send a tweet with a picture - BrokenPipeError: [Errno 32]

Issues related to configuring your network
Post Reply
alepg
Posts: 1
Joined: 2014/11/26 11:17:30

To send a tweet with a picture - BrokenPipeError: [Errno 32]

Post by alepg » 2014/11/26 11:28:00

Hello everyone,
I’m in the process of creating a Python software procedure - my main purpose in to send a tweet with a picture. I’m using the library built for the twitter platform "Python Twitter Tools" (https://github.com/sixohsix/twitter1)
If I run the application in a Unix machine (Centos - release 5.11-Final) the system generates the following error message: BrokenPipeError: [Errno 32] Broken pipe
Instead if I decide to run the same application in a machine with Windows operating system no message error appears and the operations succeeds.

Would anyone be able to tell me why?

Thanks a lot in advance.

Best wishes,
Alessandro

Source code:

Code: Select all

try:
# Send a tweet with an image included (or set your banner or logo similarily)
# by just reading your image from the web or a file in a string:
with open(status, "rb") as imagefile:
    params = {"media[]": imagefile.read(), "status": "Test invio immagine..."}
outcome = t.statuses.update_with_media(**params)
...
Traceback (most recent call last):

File "/usr/local/lib/python3.3/urllib/request.py", line 1248, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "/usr/local/lib/python3.3/http/client.py", line 1061, in request
self.sendrequest(method, url, body, headers)
File "/usr/local/lib/python3.3/http/client.py", line 1099, in sendrequest
self.endheaders(body)
File "/usr/local/lib/python3.3/http/client.py", line 1057, in endheaders
self.sendoutput(message_body)
File "/usr/local/lib/python3.3/http/client.py", line 902, in sendoutput
self.send(msg)
File "/usr/local/lib/python3.3/http/client.py", line 871, in send
self.sock.sendall(data)
File "/usr/local/lib/python3.3/ssl.py", line 425, in sendall
v = self.send(data[count:])
File "/usr/local/lib/python3.3/ssl.py", line 386, in send
v = self._sslobj.write(data)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/dstar/tmp/test2.py", line 53, in
polling()
File "/dstar/tmp/test2.py", line 49, in polling
send_to_twitter("image.jpg")
File "/dstar/tmp/test2.py", line 31, in send_to_twitter
outcome = t.statuses.update_with_media(**params)
File "/usr/local/lib/python3.3/site-packages/twitter-1.10.0-py3.3.egg/twitter/api.py", line 204, in call
return self.handleresponse(req, uri, arg_data, _timeout)
File "/usr/local/lib/python3.3/site-packages/twitter-1.10.0-py3.3.egg/twitter/api.py", line 211, in handleresponse
handle = urllib_request.urlopen(req, **kwargs)
File "/usr/local/lib/python3.3/urllib/request.py", line 156, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.3/urllib/request.py", line 469, in open
response = self._open(req, data)
File "/usr/local/lib/python3.3/urllib/request.py", line 487, in _open
'_open', req)
File "/usr/local/lib/python3.3/urllib/request.py", line 447, in callchain
result = func(*args)
File "/usr/local/lib/python3.3/urllib/request.py", line 1283, in https_open
context=self.context, checkhostname=self.checkhostname)
File "/usr/local/lib/python3.3/urllib/request.py", line 1251, in do_open
raise URLError(err)
urllib.error.URLError: urlopen error [Errno 32] Broken pipe>

Trace TCP/IP:
...
19:21:53.180764 IP 10.0.0.2.25232 > ns1.p34.dynect.net.domain: 30001 [1au] AAAA? api.twitter.com. (44)
19:21:53.225168 IP ns1.p34.dynect.net.domain > 10.0.0.2.25232: 30001*- 0/1/1 (116)
19:21:53.227612 IP 10.0.0.2.14642 > ns3.p34.dynect.net.domain: 32103 [1au] A? api.twitter.com. (44)
19:21:53.299637 IP ns3.p34.dynect.net.domain > 10.0.0.2.14642: 32103*- 4/4/1 A 199.16.156.40,[|domain]
19:21:53.305391 IP 10.0.0.2.52772 > 199.16.156.72.https: S 1062698777:1062698777(0) win 5840
19:21:53.461770 IP 199.16.156.72.https > 10.0.0.2.52772: S 898493203:898493203(0) ack 1062698778 win 14480
19:21:53.461802 IP 10.0.0.2.52772 > 199.16.156.72.https: . ack 1 win 46
19:21:53.462067 IP 10.0.0.2.52772 > 199.16.156.72.https: P 1:73(72) ack 1 win 46
19:21:53.593662 IP 199.16.156.72.https > 10.0.0.2.52772: . ack 73 win 57
19:21:53.594277 IP 199.16.156.72.https > 10.0.0.2.52772: . 1:1401(1400) ack 73 win 57
19:21:53.594773 IP 199.16.156.72.https > 10.0.0.2.52772: . 1401:2801(1400) ack 73 win 57
19:21:53.595596 IP 199.16.156.72.https > 10.0.0.2.52772: P 2801:2936(135) ack 73 win 57
19:21:53.596048 IP 10.0.0.2.52772 > 199.16.156.72.https: . ack 1401 win 69
19:21:53.596056 IP 10.0.0.2.52772 > 199.16.156.72.https: . ack 2801 win 91
19:21:53.596060 IP 10.0.0.2.52772 > 199.16.156.72.https: . ack 2936 win 113
19:21:53.596757 IP 10.0.0.2.52772 > 199.16.156.72.https: P 73:399(326) ack 2936 win 113
...
19:21:56.422471 IP 10.0.0.2.52772 > 199.16.156.72.https: P 106821:108249(1428) ack 2995 win 113
19:21:56.422476 IP 10.0.0.2.52772 > 199.16.156.72.https: . 108249:109677(1428) ack 2995 win 113
19:21:56.422754 IP 199.16.156.72.https > 10.0.0.2.52772: P 2995:3176(181) ack 99681 win 59
19:21:56.423218 IP 199.16.156.72.https > 10.0.0.2.52772: P 3176:3213(37) ack 99681 win 61
19:21:56.424783 IP 199.16.156.72.https > 10.0.0.2.52772: F 3213:3213(0) ack 99681 win 61
19:21:56.430299 IP 199.16.156.72.https > 10.0.0.2.52772: R 898496198:898496198(0) win 0
19:21:56.441472 IP 199.16.156.72.https > 10.0.0.2.52772: R 898496198:898496198(0) win 0
...

Post Reply