Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[OT] problema rete python.
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano
View previous topic :: View next topic  
Author Message
GiovanniV
n00b
n00b


Joined: 31 Jan 2005
Posts: 37

PostPosted: Sat Sep 03, 2005 4:39 pm    Post subject: [OT] problema rete python. Reply with quote

Ciao,
la macchina in questione è un iBook (Gentoo 2005.0).
Ho uno script in Python che scarica una pagina web (mediante urllib).
Lo script funziona bene sotto OSX, mentre sotto Gentoo non riesce a connettersi ed ecco cosa risulta:

Code:

$ netstat -tn
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      1 192.168.1.4:46279       1.0.0.0:80              SYN_SENT


:?: 1.0.0.0:80 SYN_SENT
Preciso che sono dietro un router ed acquisisco l'ip tramite dhcp.

Qualche idea?

Grazie e ciao.
Back to top
View user's profile Send private message
randomaze
Bodhisattva
Bodhisattva


Joined: 21 Oct 2003
Posts: 9985

PostPosted: Sat Sep 03, 2005 4:47 pm    Post subject: Re: [OT] problema rete python. Reply with quote

GiovanniV wrote:
1.0.0.0:80


IMHO la porta ottanta di quell'indirizzo IP non ti risponderá mai.

Sei sicuro dell'IP destinazione?
_________________
Ciao da me!
Back to top
View user's profile Send private message
GiovanniV
n00b
n00b


Joined: 31 Jan 2005
Posts: 37

PostPosted: Sat Sep 03, 2005 4:59 pm    Post subject: Reply with quote

L'indirizzo è OK:
http://www.python.org/

forse ho capito di che si tratta; ho sostituito all'url l'indirizzo ip
corrispondente:
http://194.109.137.226/
e funziona.

.. problemi nella risoluzione degli indirizzi ..?

Dove vado a pescare?
Back to top
View user's profile Send private message
randomaze
Bodhisattva
Bodhisattva


Joined: 21 Oct 2003
Posts: 9985

PostPosted: Sun Sep 04, 2005 12:16 am    Post subject: Reply with quote

GiovanniV wrote:
Dove vado a pescare?


Nel codice.... e nella documentazione di python. Forse lo script usa una modalitá particolare (che funziona su OSX e su linux No) per riolvere l'indirizzo
_________________
Ciao da me!
Back to top
View user's profile Send private message
GiovanniV
n00b
n00b


Joined: 31 Jan 2005
Posts: 37

PostPosted: Sun Sep 04, 2005 6:51 am    Post subject: Reply with quote

randomaze wrote:

Nel codice.... e nella documentazione di python. Forse lo script usa una modalitá particolare (che funziona su OSX e su linux No) per riolvere l'indirizzo

Per aprire l'url utilizzo:
Code:

...
urllib.urlopen(addr)
...

e dalla documentazione vedo che:
Code:

The urlopen() function works transparently with proxies which do not require authentication. In a Unix or Windows environment, set the http_proxy, ftp_proxy or gopher_proxy environment variables to a URL that identifies the proxy server before starting the Python interpreter. For example (the "%" is the command prompt):

% http_proxy="http://www.someproxy.com:3128"
% export http_proxy
% python
...

In a Windows environment, if no proxy environment variables are set, proxy settings are obtained from the registry's Internet Settings section.

In a Macintosh environment, urlopen() will retrieve proxy information from Internet Config.

Ora so di essere dietro un router (che risponde all'indirizzo interno 192.168.1.1)
e di non aver settato la variabile http_proxy.
Ho provato a metterla a "http://192.168.1.1:80" ma le cose non vanno bene!
Back to top
View user's profile Send private message
GiovanniV
n00b
n00b


Joined: 31 Jan 2005
Posts: 37

PostPosted: Mon Sep 05, 2005 1:37 pm    Post subject: Reply with quote

Ecco alcuni test the sto facendo per capire qual è il problema:
(Tutti i test dietro lo stesso router)

Sul mio iBook:
* Mac OSX: OK.
* Gentoo 2005.0, testato con default python2.3.4 e con python2.4.1: KO
* Gentoo 2004.3 LiveCD: KO

Sul mio desktop intel:
* Gentoo 2005.0: KO
* Knoppix LiveCD: OK.

Questo è quanto. Sembra essere legato a Gentoo!?!
Back to top
View user's profile Send private message
randomaze
Bodhisattva
Bodhisattva


Joined: 21 Oct 2003
Posts: 9985

PostPosted: Mon Sep 05, 2005 6:13 pm    Post subject: Reply with quote

GiovanniV wrote:
Sembra essere legato a Gentoo!?!


Secondo me é piú legato al DNS che a gentoo.

Ho appena fatto una prova veloce:
Code:
Python 2.3.5 (#1, Apr 30 2005, 12:45:20)
[GCC 3.3.5-20050130 (Gentoo Linux 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie- on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> pippo = urllib.urlopen('http://www.gentoo.org')
>>> print pippo
<addinfourl at -1211716116 whose fp = <socket._fileobject object at 0xb7c68924>>
>>> pippo.close()


E cercare di aprire il syn su 1.0.0.0 come facevi tu da un risultato nettamente peggiore:

Code:
>>> pippo = urllib.urlopen('http://1.0.0.0:80')

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/urllib.py", line 76, in urlopen
    return opener.open(url)
  File "/usr/lib/python2.3/urllib.py", line 181, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.3/urllib.py", line 297, in open_http
    h.endheaders()
  File "/usr/lib/python2.3/httplib.py", line 715, in endheaders
    self._send_output()
  File "/usr/lib/python2.3/httplib.py", line 600, in _send_output
    self.send(msg)
  File "/usr/lib/python2.3/httplib.py", line 567, in send
    self.connect()
  File "/usr/lib/python2.3/httplib.py", line 551, in connect
    raise socket.error, msg
IOError: [Errno socket error] (110, 'Connection timed out')
>>>

_________________
Ciao da me!
Back to top
View user's profile Send private message
GiovanniV
n00b
n00b


Joined: 31 Jan 2005
Posts: 37

PostPosted: Mon Sep 05, 2005 7:21 pm    Post subject: Reply with quote

randomaze wrote:

...
E cercare di aprire il syn su 1.0.0.0 come facevi tu da un risultato nettamente peggiore:
...

Io non ho mai cercato di connettermi a 1.0.0.0, ma questo è quanto risulta dall'output di netstat
quando cerco di connettermi ad un qualsiasi url con la funzione urllib.urlopen(...).
Come dici tu deve essere un problema di dns, ma dalle prove fatte sembra proprio essere
specifico delle mie installazioni di Gentoo.
(Per inciso ora che provo emerge dietro questo router anche lui soffre dello stesso identico
problema, rendendomi impossibile l'installazione di qualsiasi programma).
Back to top
View user's profile Send private message
randomaze
Bodhisattva
Bodhisattva


Joined: 21 Oct 2003
Posts: 9985

PostPosted: Mon Sep 05, 2005 7:44 pm    Post subject: Reply with quote

GiovanniV wrote:
(Per inciso ora che provo emerge dietro questo router anche lui soffre dello stesso identico
problema, rendendomi impossibile l'installazione di qualsiasi programma).


E tutte le altre applicazioni funzionano? Un browser? Il ping?
_________________
Ciao da me!
Back to top
View user's profile Send private message
GiovanniV
n00b
n00b


Joined: 31 Jan 2005
Posts: 37

PostPosted: Tue Sep 06, 2005 5:31 am    Post subject: Reply with quote

randomaze wrote:
E tutte le altre applicazioni funzionano? Un browser? Il ping?

Il bello è che tutto il resto funziona compresi browser, ping, host, ecc.
E' solo python che mi da questo problema (ed è un bel problema vista la natura di emerge!).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum