Re: SSL Socket Error

2015-05-09 Thread Kev Dwyer
shdwkee...@gmail.com wrote:

> Ive setup a Debian server with Python 2.7.9.  Have everything running and
> SSL as well, but when I try and login to using HTTPS:// I get this error:
> 
> Incoming web connection from ('192.168.15.177', 53202)
> error: uncaptured python exception, closing channel  listening :8111 at 0x75ea7b48> (:certfile must be specified for
> server-side operations [/usr/lib/python2.7/asyncore.py|read|83]
> [/usr/lib/python2.7/asyncore.py|handle_read_event|443]
> [./alarmserver.py|handle_accept|456]
> [/usr/lib/python2.7/ssl.py|wrap_socket|891]
> [/usr/lib/python2.7/ssl.py|init|498])
> 
> Any ideas how to resolve?

It looks like the exception is coming up through alarmserver.py, which seems 
to be based on https://github.com/juggie/AlarmServer (I'm not entirely
certain because the line numbers don't seem to match).  Anyway, looking at 
the code for alarmserver.py it expects to find certificate paths defined in
its config file, but they are undefined.

The sample config file for the project includes this section:

## The server runs with SSL. You need a certificate and key
## server.crt and server.key are included but you should 
## generate your own.
## If left blank the default included cert/key will be used
#certfile=/etc/apache2/ssl/server.crt
#keyfile=/etc/apache2/ssl/server.key
certfile=
keyfile=

So I think you need to start by examining the config file on your server.

Good luck,

Kev

-- 
https://mail.python.org/mailman/listinfo/python-list


SSL Socket Error

2015-05-08 Thread shdwkeeper
Ive setup a Debian server with Python 2.7.9.  Have everything running and SSL 
as well, but when I try and login to using HTTPS:// I get this error:

Incoming web connection from ('192.168.15.177', 53202)
error: uncaptured python exception, closing channel  (:certfile must be specified for server-side operations 
[/usr/lib/python2.7/asyncore.py|read|83] 
[/usr/lib/python2.7/asyncore.py|handle_read_event|443] 
[./alarmserver.py|handle_accept|456] 
[/usr/lib/python2.7/ssl.py|wrap_socket|891] 
[/usr/lib/python2.7/ssl.py|init|498])

Any ideas how to resolve?
-- 
https://mail.python.org/mailman/listinfo/python-list


Socket Error : Address still in use (Conveting from python 1.5.2 to 2.7.1)

2012-03-27 Thread Wong Wah Meng-R32813
Hello there,

I am in the midst of converting my application from python 1.5.2 to python 
2.7.1 on HP-UX 11 Itanium box. 

My application server will set a listening port, accepting request from 
multiple clients. The code just works fine in the old python environment. E.g. 
when I do a lsof | grep  I got the following.

python 62602  genasm5u  IPv4 0x7350d1f00t0  TCP 
zmy02aix02:12121 (LISTEN)
python 62602  genasm6u  IPv4 0x744fb5f00t0  TCP 
zmy02aix02:12121->zmy02aix02-bkup:51867 (ESTABLISHED)
python 62602  genasm7u  IPv4 0x75b959f00t0  TCP 
zmy02aix02:12121->zmy02aix02-bkup:51869 (ESTABLISHED)
python 62602  genasm8u  IPv4 0x75a559f00t0  TCP 
zmy02aix02:12121->zmy02aix02-bkup:51873 (ESTABLISHED)

Strange things happened in python 2.7.1. Without modifying the code of how the 
socket was created and how the TCP/IP address was bound to the socket, it seems 
that every other processes that I run, which supposed to connect to the 
listening port as a client program, also appears to be holding a listening 
port. This is weird. Anyone has encountered this before especially when you 
were converting from an old python to a new python? Like you can see below 
there are 5 processes hosting the listening port of 18882.

$ lsof -i tcp | grep 18882
python  10598 r328133u  IPv4 0xe0050b73e400   0t0  TCP 
zmy02hp3.ap.freescale.net:18882 (LISTEN)
python  18181 r328133u  IPv4 0xe0050b73e400   0t0  TCP 
zmy02hp3.ap.freescale.net:18882 (LISTEN)
python  20025 r328133u  IPv4 0xe0050b73e400   0t0  TCP 
zmy02hp3.ap.freescale.net:18882 (LISTEN)
python  26295 r328133u  IPv4 0xe0050b73e400   0t0  TCP 
zmy02hp3.ap.freescale.net:18882 (LISTEN)
python  26428 r328133u  IPv4 0xe0050b73e400   0t0  TCP 
zmy02hp3.ap.freescale.net:18882 (LISTEN)

Since only one of them is the genuine process holding the port, I need to kill 
off the rest of the process if I need to restart the genuine process running 
under that port. It should not work this way. 

Here is the code of the application process that hosts the listening port. 

self.sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
self.sock.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, 1 )
self.sock.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1
self.sock.setsockopt( socket.IPPROTO_TCP, _TCP_NODELAY, 1 )
self.sock.bind( self.server_address )
  

Here is the client code that does the connection.

   self.sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
   self.sock.setsockopt( socket.IPPROTO_TCP, _TCP_NODELAY, 1 )
   self.sock.connect( self.server_address )

Regards,
Wah Meng

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket error 98 "Address already in use"

2010-06-17 Thread AK
On 06/17/2010 08:59 PM, Grant Edwards wrote:
> On 2010-06-18, AK  wrote:
> 
>> Here it is:
>>
>> Traceback (most recent call last):
>>   File "./vimp3_player.py", line 112, in 
>> Player().main()
>>   File "./vimp3_player.py", line 35, in main
>> self.listen()
>>   File "./vimp3_player.py", line 41, in listen
>> s.bind((HOST, PORT))
>>   File "", line 1, in bind
>> socket.error: [Errno 98] Address already in use
> 
> Setting the SO_REUSEADDR option should prevent that, and in my
> experience it always does.  What OS are you using?
> 
> Is there some reason you want to rebind each time?  Why not just loop
> around the conn,addr = accept()  con.close() section?

That solved it! Thanks!@ Interesting that closing and rebinding caused
this but not right away but after 3-4 connections. My OS is Ubuntu, by
the way. Thanks again, -ak
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket error 98 "Address already in use"

2010-06-17 Thread Grant Edwards
On 2010-06-18, AK  wrote:

> Here it is:
>
> Traceback (most recent call last):
>   File "./vimp3_player.py", line 112, in 
> Player().main()
>   File "./vimp3_player.py", line 35, in main
> self.listen()
>   File "./vimp3_player.py", line 41, in listen
> s.bind((HOST, PORT))
>   File "", line 1, in bind
> socket.error: [Errno 98] Address already in use

Setting the SO_REUSEADDR option should prevent that, and in my
experience it always does.  What OS are you using?

Is there some reason you want to rebind each time?  Why not just loop
around the conn,addr = accept()  con.close() section?

> It'd be a bit difficult to separate it, I was hoping this is a known
> issue and this description would be enough, but if that turns out not to
> be the case I'll make a minimal working example.

It is a known issue, but it's solved by setting the REUSEADDR option
on the socket before calling bind().  Are you sure you don't somehow
leave a server running on that port that prevents the bind() from
working?

-- 
Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket error 98 "Address already in use"

2010-06-17 Thread AK
On 06/17/2010 08:19 PM, Grant Edwards wrote:
> On 2010-06-17, AK  wrote:
>> Hi, I'm trying to make a little mp3 server / client and I'm running into
>> a problem with the Socket error 98 "Address already in use". The error
>> doesn't happen right away, I can send 3-4 commands, disconnecting and
>> reconnecting and they work fine and then I get this error and the client
>> can no longer connect, although the client side doesn't get any errors.
>> Here's the relevant code:
>>
>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>> s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
>> s.bind((HOST, PORT))
>> s.listen(1)
>> conn, addr = s.accept()
>> try: self.player(conn, addr)
>> except: pass
>> conn.close()
>> s.close()
>> del s
> 
> Always, always, always: post the traceback.

Here it is:

Traceback (most recent call last):
  File "./vimp3_player.py", line 112, in 
Player().main()
  File "./vimp3_player.py", line 35, in main
self.listen()
  File "./vimp3_player.py", line 41, in listen
s.bind((HOST, PORT))
  File "", line 1, in bind
socket.error: [Errno 98] Address already in use


> 
> If that's your server code, I don't see how you can disconnect and
> reconnect.  That code only accepts a single connection, then it's done.

It's in a while 1: loop. self.player() just takes in a single command
and then returns.

> 
> Also always: post minim but real code the shows the problem.

It'd be a bit difficult to separate it, I was hoping this is a known
issue and this description would be enough, but if that turns out not to
be the case I'll make a minimal working example.

Thanks for the reply! -ak
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket error 98 "Address already in use"

2010-06-17 Thread Grant Edwards
On 2010-06-17, AK  wrote:
> Hi, I'm trying to make a little mp3 server / client and I'm running into
> a problem with the Socket error 98 "Address already in use". The error
> doesn't happen right away, I can send 3-4 commands, disconnecting and
> reconnecting and they work fine and then I get this error and the client
> can no longer connect, although the client side doesn't get any errors.
> Here's the relevant code:
>
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
> s.bind((HOST, PORT))
> s.listen(1)
> conn, addr = s.accept()
> try: self.player(conn, addr)
> except: pass
> conn.close()
> s.close()
> del s

Always, always, always: post the traceback.

If that's your server code, I don't see how you can disconnect and
reconnect.  That code only accepts a single connection, then it's done.

Also always: post minim but real code the shows the problem.

-- 
Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket error 98 "Address already in use"

2010-06-17 Thread AK
On 06/17/2010 07:21 PM, AK wrote:
> Hi, I'm trying to make a little mp3 server / client and I'm running into
> a problem with the Socket error 98 "Address already in use". The error
> doesn't happen right away, I can send 3-4 commands, disconnecting and
> reconnecting and they work fine and then I get this error and the client
> can no longer connect, although the client side doesn't get any errors.
> Here's the relevant code:
> 
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
> s.bind((HOST, PORT))
> s.listen(1)
> conn, addr = s.accept()
> try: self.player(conn, addr)
> except: pass
> conn.close()
> s.close()
> del s
> 
> 
> .. and on client:
> 
> 
> HOST = ''
> PORT = 50025
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
> s.connect((HOST, PORT))
> 
> 
> Thanks! -ak


I forgot to add that I'm on Ubuntu 9.10 and using python 2.6. -ak
-- 
http://mail.python.org/mailman/listinfo/python-list


Socket error 98 "Address already in use"

2010-06-17 Thread AK
Hi, I'm trying to make a little mp3 server / client and I'm running into
a problem with the Socket error 98 "Address already in use". The error
doesn't happen right away, I can send 3-4 commands, disconnecting and
reconnecting and they work fine and then I get this error and the client
can no longer connect, although the client side doesn't get any errors.
Here's the relevant code:

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
try: self.player(conn, addr)
except: pass
conn.close()
s.close()
del s


.. and on client:


HOST = ''
PORT = 50025
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.connect((HOST, PORT))


Thanks! -ak
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket Error: Permission Denied

2010-02-09 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 7:38 PM, W. eWatson  wrote:

> I'm using McAffee. I see it was pythonw.exe blocked in red. There are
> several choices: Allow Access, Allow Outboubnd only
> Block (current), Remove Prgrm permission, Learn More.
>
> Outbound only seem reasonable, but why does the blocking keep returning
> every many hours, or maybe when I reboot, which I've done several times
> today?


I can't help you with McAfee, contact their support forums.

As for outbound vs anything else... pythonw.exe needs to accept connections
at least on the local machine. No idea how to get McAfee to allow that.
Outbound may not be sufficient, you may need just Allow.

--S
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket Error: Permission Denied

2010-02-09 Thread W. eWatson
I decided to go with outbound. Now when I run the program, I get a long 
of messabge about deprecations and  NumpyTest will be removed in the 
next release. please update code to nose or unittest.


--
http://mail.python.org/mailman/listinfo/python-list


Re: Socket Error: Permission Denied (Firewall)

2010-02-09 Thread W. eWatson

(corrected typos)
I decided to go with outbound in McAfee. Now when I run the program, I 
get a long list of messages about deprecations and  NumpyTest will be 
removed in the next release. please update code to nose or unittest.


--
http://mail.python.org/mailman/listinfo/python-list


Re: Socket Error: Permission Denied

2010-02-08 Thread W. eWatson

On 2/8/2010 7:24 PM, W. eWatson wrote:

I'm using IDLE with winxp. It seems every day I get into the Subject
above. Usually, after 5-8 minutes I get past it. A msg appearing at the
same time say, "IDLE's subprocess didn't make connect. ... possible
firewall problem."

A resource for this is . There a
number of choices. Perhaps the most appealing is:

adgprogramming: first, bring up your task manager and make sure there
are no python processes running. 2.6.x subprocesses can get stuck.
Then make sure that your firewall isn't blocking socket access to
localhost. Then restart IDLE. IDLE 3.1.1 may work for you since it
has the recent enhancement that allows multiple copies of IDLE to run
simultaneously, but it still needs interprocess access via sockets.

How would I know the which Python processes or subprocesses are running?
I can kill the main one, but that seems to do no good.
pythonw.exe.

Comments?
I'm using McAffee. I see it was pythonw.exe blocked in red. There are 
several choices: Allow Access, Allow Outboubnd only

Block (current), Remove Prgrm permission, Learn More.

Outbound only seem reasonable, but why does the blocking keep returning 
every many hours, or maybe when I reboot, which I've done several times 
today?

--
http://mail.python.org/mailman/listinfo/python-list


Socket Error: Permission Denied

2010-02-08 Thread W. eWatson
I'm using IDLE with winxp. It seems every day I get into the Subject 
above. Usually, after 5-8 minutes I get past it. A msg appearing at the 
same time say, "IDLE's subprocess didn't make connect. ... possible 
firewall problem."


A resource for this is . There a 
number of choices. Perhaps the most appealing is:


adgprogramming: first, bring up your task manager and make sure there
are no python processes running.  2.6.x subprocesses can get stuck.
Then make sure that your firewall isn't blocking socket access to
localhost.  Then restart IDLE.  IDLE 3.1.1 may work for you since it
has the recent enhancement that allows multiple copies of IDLE to run
simultaneously, but it still needs interprocess access via sockets.

How would I know the which Python processes or subprocesses are running? 
I can kill the main one, but that seems to do no good.

pythonw.exe.

Comments?
--
http://mail.python.org/mailman/listinfo/python-list


Re: smtplib.SMTP throw : 'Socket error: 10053 software caused connection abort'

2009-01-21 Thread aberry


aberry wrote:
> 
> I am using 'smtplib' module to send an email but getting exception...
> 
> smtplib.SMTP( throw error :
> 
> here is trace back snippet :-
> 
> "   smtp = smtplib.SMTP(self.server)
>  File "D:\Python24\lib\smtplib.py", line 244, in __init__
>(code, msg) = self.connect(host, port)
>  File "D:\Python24\lib\smtplib.py", line 306, in connect
>raise socket.error, msg
> socket.error: (10053, 'Software caused connection abort')"
> 
> thanks in adv,
> aberry
> 
> 

problem resolved :) ... culprit was Anti Virus  running on my Win XP
machine...
I disabled AV On Access scan... no Error and email sent

rgds,
aberry
-- 
View this message in context: 
http://www.nabble.com/smtplib.SMTP-throw-%3A-%27Socket-error%3A-10053-software-caused-connection-abort%27-tp21565011p21579963.html
Sent from the Python - python-list mailing list archive at Nabble.com.

--
http://mail.python.org/mailman/listinfo/python-list


smtplib.SMTP throw : 'Socket error: 10053 software caused connection abort'

2009-01-20 Thread aberry

I am using 'smtplib' module to send an email but getting exception...

smtplib.SMTP( throw error :

here is trace back snippet :-

"   smtp = smtplib.SMTP(self.server)
 File "D:\Python24\lib\smtplib.py", line 244, in __init__
   (code, msg) = self.connect(host, port)
 File "D:\Python24\lib\smtplib.py", line 306, in connect
   raise socket.error, msg
socket.error: (10053, 'Software caused connection abort')"

thanks in adv,
aberry



-- 
View this message in context: 
http://www.nabble.com/smtplib.SMTP-throw-%3A-%27Socket-error%3A-10053-software-caused-connection-abort%27-tp21565011p21565011.html
Sent from the Python - python-list mailing list archive at Nabble.com.

--
http://mail.python.org/mailman/listinfo/python-list


Re: socket error: connection refused?

2008-06-23 Thread cirfu
On 23 Juni, 20:55, [EMAIL PROTECTED] wrote:
> It's a security conflict. You should be able to run it again and have
> it work. Our company's cisco does the same thing (even after we
> approve the app)

doesnt work but i found out i should open the task manager and kill
all the python processes, then it works.
--
http://mail.python.org/mailman/listinfo/python-list


Re: socket error: connection refused?

2008-06-23 Thread hall . jeff
It's a security conflict. You should be able to run it again and have
it work. Our company's cisco does the same thing (even after we
approve the app)
--
http://mail.python.org/mailman/listinfo/python-list


socket error: connection refused?

2008-06-23 Thread cirfu
The first time i start the shell it always works. But often after
closing it and restarting it I get:

Two windows pops up and the shell, after clicking the windows the
shell just closes by itself.


socket error: connection refused

IDLE's subprocess didnt make connection.


im using python 2.5.1 and windows vista.
--
http://mail.python.org/mailman/listinfo/python-list


Re: socket error when loading the shell?

2008-03-31 Thread Gabriel Genellina
En Mon, 31 Mar 2008 23:28:13 -0300, <[EMAIL PROTECTED]> escribió:

> tried wi5th the normal IDLE too and it worked later after i posted
> this but now it doesnt work again. and i havent chnaged my firewall in
> between.

Perhaps any other running process has opened the port that IDLE uses to  
communicate with the running program. Or you have IDLE already running.  
See if you have python.exe/pythonw.exe processes running.
Or go to Help, IDLE Help, and read the section "Running without a  
subprocess"

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socket error when loading the shell?

2008-03-31 Thread vokinloksar
i mean vpython(www.vpython.org).

tried wi5th the normal IDLE too and it worked later after i posted
this but now it doesnt work again. and i havent chnaged my firewall in
between.


python.exe works but i want the idle not the dos-interpreter.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socket error when loading the shell?

2008-03-30 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote:
> using python and wpython.

What's wpython?
 
> when using run module or python shell on the run menu in the GUI i
> get "socket error, connection refused".
> 
> it worked before, what si wrong now?

There's no process listening for the port you try to connect to, so
the target host refuses.

> and i cant find where to start the shell directly. 

Well, for me, ALT-F2 xterm[Enter] works.

> think i had an exe before but cant seem to find it now.

You mean the Python interpreter? It's probably located on your
system root in a directory called python. But I'd rather
use IDLE.

Regards,


Björn

-- 
BOFH excuse #338:

old inkjet cartridges emanate barium-based fumes

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socket error when loading the shell?

2008-03-30 Thread Gabriel Genellina
En Sun, 30 Mar 2008 16:46:00 -0300, <[EMAIL PROTECTED]> escribió:

> using python and wpython.

Soory, I don't know what wpython is

> when using run module or python shell on the run menu in the GUI i get
> "socket error, connection refused".
>
> it worked before, what si wrong now?

Try to detect what changed on your system between "before" and "now".

> and i cant find where to start the shell directly. think i had an exe
> before but cant seem to find it now.

python.exe?

> c:
> cd \
> dir /s python.exe

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


socket error when loading the shell?

2008-03-30 Thread vokinloksar
hi

using python and wpython.

when using run module or python shell on the run menu in the GUI i get
"socket error, connection refused".

it worked before, what si wrong now?

and i cant find where to start the shell directly. think i had an exe
before but cant seem to find it now.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IDLE Won't Start w/o Socket Error--Win XP

2008-02-12 Thread W. Watson
Thanks. That did the trick.

Mike Driscoll wrote:
> On Feb 12, 2:18 pm, "W. Watson" <[EMAIL PROTECTED]> wrote:
>> After simply trying to write a program with help(MakeQTE), a module, and
>> having it fail with socket errors, I decided to restart IDLE, thinking I
...
> 
> I sometimes get this message when one of my programs fails to shutdown
> properly. I program almost exclusively in Windows, so I open Task
> Manager and kill all instance of Python.exe to fix this problem. I
> have seen ZoneAlarm flag IDLE when I first installed Python, so if you
> upgraded it recently, the firewall may be an issue.
> 
> Mike

-- 
  Wayne Watson (Nevada City, CA)

Web Page: 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IDLE Won't Start w/o Socket Error--Win XP

2008-02-12 Thread Gabriel Genellina
En Tue, 12 Feb 2008 18:18:20 -0200, W. Watson <[EMAIL PROTECTED]>  
escribió:

> After simply trying to write a program with help(MakeQTE), a module, and
> having it fail with socket errors, I decided to restart IDLE, thinking I
> knew the cause. I'm now getting msgs like: "IDLE's subprocess didn't make
> connection. ... firewall may be blocking the connection." I doubt the FW
> connection. There's a small X warning dialog that says "Socket Error:
> Connection refused." Is there a way to reset IDLE?

 From the IDLE About box:

IDLE executes Python code in a separate process, which is restarted for  
each
Run (F5) initiated from an editor window.  The environment can also be
restarted from the Shell window without restarting IDLE.

(Personal firewall software may warn about the connection IDLE makes to its
subprocess using this computer's internal loopback interface.  This  
connection
is not visible on any external interface and no data is sent to or received
 from the Internet.)

 From the help:

Running without a subprocess:

If IDLE is started with the -n command line switch it will run in a
single process and will not create the subprocess which runs the RPC
Python execution server.  This can be useful if Python cannot create
the subprocess or the RPC socket interface on your platform.  However,
in this mode user code is not isolated from IDLE itself.  Also, the
environment is not restarted when Run/Run Module (F5) is selected.  If
your code has been modified, you must reload() the affected modules and
re-import any specific items (e.g. from foo import baz) if the changes
are to take effect.  For these reasons, it is preferable to run IDLE
with the default subprocess if at all possible.

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IDLE Won't Start w/o Socket Error--Win XP

2008-02-12 Thread Mike Driscoll
On Feb 12, 2:18 pm, "W. Watson" <[EMAIL PROTECTED]> wrote:
> After simply trying to write a program with help(MakeQTE), a module, and
> having it fail with socket errors, I decided to restart IDLE, thinking I
> knew the cause. I'm now getting msgs like: "IDLE's subprocess didn't make
> connection. ... firewall may be blocking the connection." I doubt the FW
> connection. There's a small X warning dialog that says "Socket Error:
> Connection refused." Is there a way to reset IDLE?
> --
>   Wayne Watson (Nevada City, CA)
>
> Web Page: 

I sometimes get this message when one of my programs fails to shutdown
properly. I program almost exclusively in Windows, so I open Task
Manager and kill all instance of Python.exe to fix this problem. I
have seen ZoneAlarm flag IDLE when I first installed Python, so if you
upgraded it recently, the firewall may be an issue.

Mike
-- 
http://mail.python.org/mailman/listinfo/python-list


IDLE Won't Start w/o Socket Error--Win XP

2008-02-12 Thread W. Watson
After simply trying to write a program with help(MakeQTE), a module, and 
having it fail with socket errors, I decided to restart IDLE, thinking I 
knew the cause. I'm now getting msgs like: "IDLE's subprocess didn't make 
connection. ... firewall may be blocking the connection." I doubt the FW 
connection. There's a small X warning dialog that says "Socket Error: 
Connection refused." Is there a way to reset IDLE?
-- 
  Wayne Watson (Nevada City, CA)

Web Page: 
-- 
http://mail.python.org/mailman/listinfo/python-list


Socket Error 106: 'Transport endpoint is already connected'

2007-01-17 Thread palmem
I am trying to write a simple FTP server in order to learn about
sockets
This is my first time trying sockets

This code should take a connection on port 8110, dump it to a client
"thread" (not a thread yet), print "Test\n" to the thread, and close
everything.
It fails on creating the client thread with error  106: 'Transport
endpoint is already connected'

On running the code:
dftp starting
getting the socket at 127.0.0.1 at port 8110
listening for 5 connections
entering main loop
pause here until telnet
found a client @  addr:
('127.0.0.1', 58643)
Creating a new client socket
Trying to connect
Traceback (most recent call last):
  File "./dftpd.py", line 46, in ?
main()
  File "./dftpd.py", line 41, in main
clientThread = Connection(clientsocket, address);
  File "/home/palmer/prog/dftp/dftpd/connection.py", line 29, in
__init__
self.sock.connect(a);
  File "", line 1, in connect
socket.error: (106, 'Transport endpoint is already connected')

Telnet output:
$ telnet localhost 8110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

Here's my code:
config is a stand-in for a config-file reader, now it just runs
localhost:8110 and 5 connections
debug just prints to standard out (the number afterwords is the level,
but now everything is printed)
#dftpd.py#
import debug
import socket
import config
from connection import Connection

shouldRun=True;

def main():
debug.stdout("dftp starting", 1)
debug.stdout("getting the socket at " + str(config.listenAddress()) +
" at port " + str(config.listenPort()), 10);
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM);
sock.bind((config.listenAddress(), config.listenPort()));
debug.stdout("listening for " + str(config.listenConnections()) + "
connections", 10);
sock.listen(config.listenConnections());
debug.stdout("entering main loop", 10);
while shouldRun:
(clientsocket, address) = sock.accept();
debug.stdout("found a client @ " + str(clientsocket) + " addr: 
" +
str(address), 10);
clientThread = Connection(clientsocket, address);
print clientThread.write("Test\n");
clientThread.close;
sock.close();

main()

connection.py
import debug;
import socket;

class Connection:
def __init__(self, s, a):
debug.stdout("Creating a new client socket", 15);
self.sock = s;
debug.stdout("Trying to connect", 15);
self.sock.connect(a);
debug.stdout("Making the file over the socket", 15);
self.file = self.sock.makefile();
def read():
return file.read();
def write(out):
file.write(out);
def close():
file.close();
sock.close();

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: urllib.urlopen: Errno socket error

2006-11-09 Thread frifri007

[EMAIL PROTECTED] a écrit :

> Hi,
>
> I'm just trying to read from a webpage with urllib but I'm getting
> IOErrors. This is my code:
>
> import urllib
> sock = urllib.urlopen("http://www.google.com/";)
>
> and this is the error:
>
> Traceback (most recent call last):
>   File "", line 1, in 
> sock = urllib.urlopen("http://www.google.com/";)
>   File "C:\Python25\lib\urllib.py", line 82, in urlopen
> return opener.open(url)
>   File "C:\Python25\lib\urllib.py", line 190, in open
> return getattr(self, name)(url)
>   File "C:\Python25\lib\urllib.py", line 325, in open_http
> h.endheaders()
>   File "C:\Python25\lib\httplib.py", line 856, in endheaders
> self._send_output()
>   File "C:\Python25\lib\httplib.py", line 728, in _send_output
> self.send(msg)
>   File "C:\Python25\lib\httplib.py", line 695, in send
> self.connect()
>   File "C:\Python25\lib\httplib.py", line 679, in connect
> raise socket.error, msg
> IOError: [Errno socket error] (10060, 'Operation timed out')
>
> I'm behind my company's firewall. Would that cause a problem? If it
> does, How do I get around it?


See the documentation for urllib.urlopen:

"""
In a Windows environment, if no proxy environment variables are set,
proxy settings are obtained from the registry's Internet Settings
section.
"""
Remove Proxy configuration under IE and try again
(don't use Ie anymore ;0)

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: urllib.urlopen: Errno socket error

2006-10-17 Thread kgrafals
Dennis,

I tried a ProxyHandler with the following code ...

proxy_support = urllib2.ProxyHandler({})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)

... but it's giving me the same result.

Then I tried to tunnel using code from ...

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/213238

... but it too gave me an error ...

Traceback (most recent call last):
  File "", line 1, in 
tunnel.run(tunnel_this)
  File "C:/Python25/My Python/PyTunnel.py", line 124, in run
Threads.append( thread_it(tid=0,proxy=self.get_proxy(),\
  File "C:/Python25/My Python/PyTunnel.py", line 81, in get_proxy
proxy.connect((self._phost,self._pport))
  File "", line 1, in connect
gaierror: (11001, 'getaddrinfo failed')

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: urllib.urlopen: Errno socket error

2006-10-16 Thread kgrafals
Hi Salvatore,

Even if I catch the exceptions in a loop it goes on forever.

- ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: urllib.urlopen: Errno socket error

2006-10-16 Thread Salvatore
Hello,

Try to increase the time out : socket.settimeout(n)
and catch the timeout error when it occurs

Regards



[EMAIL PROTECTED] a écrit :

> Hi,
>
> I'm just trying to read from a webpage with urllib but I'm getting
> IOErrors. This is my code:
>
> import urllib
> sock = urllib.urlopen("http://www.google.com/";)
>
> and this is the error:
>
> Traceback (most recent call last):
>   File "", line 1, in 
> sock = urllib.urlopen("http://www.google.com/";)
>   File "C:\Python25\lib\urllib.py", line 82, in urlopen
> return opener.open(url)
>   File "C:\Python25\lib\urllib.py", line 190, in open
> return getattr(self, name)(url)
>   File "C:\Python25\lib\urllib.py", line 325, in open_http
> h.endheaders()
>   File "C:\Python25\lib\httplib.py", line 856, in endheaders
> self._send_output()
>   File "C:\Python25\lib\httplib.py", line 728, in _send_output
> self.send(msg)
>   File "C:\Python25\lib\httplib.py", line 695, in send
> self.connect()
>   File "C:\Python25\lib\httplib.py", line 679, in connect
> raise socket.error, msg
> IOError: [Errno socket error] (10060, 'Operation timed out')
>
> I'm behind my company's firewall. Would that cause a problem? If it
> does, How do I get around it?

-- 
http://mail.python.org/mailman/listinfo/python-list


urllib.urlopen: Errno socket error

2006-10-16 Thread kgrafals
Hi,

I'm just trying to read from a webpage with urllib but I'm getting
IOErrors. This is my code:

import urllib
sock = urllib.urlopen("http://www.google.com/";)

and this is the error:

Traceback (most recent call last):
  File "", line 1, in 
sock = urllib.urlopen("http://www.google.com/";)
  File "C:\Python25\lib\urllib.py", line 82, in urlopen
return opener.open(url)
  File "C:\Python25\lib\urllib.py", line 190, in open
return getattr(self, name)(url)
  File "C:\Python25\lib\urllib.py", line 325, in open_http
h.endheaders()
  File "C:\Python25\lib\httplib.py", line 856, in endheaders
self._send_output()
  File "C:\Python25\lib\httplib.py", line 728, in _send_output
self.send(msg)
  File "C:\Python25\lib\httplib.py", line 695, in send
self.connect()
  File "C:\Python25\lib\httplib.py", line 679, in connect
raise socket.error, msg
IOError: [Errno socket error] (10060, 'Operation timed out')

I'm behind my company's firewall. Would that cause a problem? If it
does, How do I get around it?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket Error: Connection Refused

2006-04-17 Thread Steve Horsley
[EMAIL PROTECTED] wrote:
> Dear c.l.p,
> 
> I have recently been doing the tutorial of Python and everything is
> well, i'm upto the pass section. Anyway, when I try to launch idle now
> I get the error message: Socket Error: Connection Refused. I do not
> have a firewall, so I don't know what is going on. Also, this comes up
> after it:
> 
> IDLE's subprocess didn't make the connection. Either IDLE can't start a
> subprocess or personal firewall software is blocking the connection.
> 
> [OK]
> 
> 
> Any help would be appreciate.
> 
> Yamas
> 
If it's not your personal firewall, then perhaps the machine you 
are trying to connect to is refusing the call. Are you sure it's 
listening on the port that you are trying to connect to?

Steve
-- 
http://mail.python.org/mailman/listinfo/python-list


Socket Error: Connection Refused

2006-04-13 Thread niceyama
Dear c.l.p,

I have recently been doing the tutorial of Python and everything is
well, i'm upto the pass section. Anyway, when I try to launch idle now
I get the error message: Socket Error: Connection Refused. I do not
have a firewall, so I don't know what is going on. Also, this comes up
after it:

IDLE's subprocess didn't make the connection. Either IDLE can't start a
subprocess or personal firewall software is blocking the connection.

[OK]


Any help would be appreciate.

Yamas

-- 
http://mail.python.org/mailman/listinfo/python-list


Socket error: 10053 software caused connection abort

2006-03-18 Thread endcompany



 
-- 
http://mail.python.org/mailman/listinfo/python-list

Socket Error

2005-11-17 Thread Chad Everett
Does anyone know why you get socket error while trying to run IDLE and the
module.  Is says something about a Subprocess Startup Error.   I know that
it always says something about a personal firewall.  I have all that shut
off.  About 50% of the time when I try and test code by running the module
it will pop up.  Any suggestions?

thanks,


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "import socket" error

2005-10-09 Thread akbar
Fedora Core 4.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "import socket" error

2005-10-09 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

> I am following this tutorial
>
https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=dw-linux-pysocks&S_TACT=105AGX59&S_CMP=GR&ca=dgr-lnxw07PythonSockets
> ( free reg. req. )
>
> The article told me to do this:
>
> [camus]$ python
> Python 2.4 (#1, Feb 20 2005, 11:25:45)
> [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
> Type "help", "copyright", "credits" or "license" for more
>information.
> >>> import socket
> >>> socket.gethostbyname('www.ibm.com')
> '129.42.19.99'
> >>>
>
> When I try it, I get this error:
> >>> import socket
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "/usr/lib/python2.4/socket.py", line 1, in ?
> # Wrapper module for _socket, providing some additional facilities
>   File "/usr/lib/python2.4/SocketServer.py", line 274, in ?
> class TCPServer(BaseServer):
>   File "/usr/lib/python2.4/SocketServer.py", line 317, in TCPServer
> address_family = socket.AF_INET
> AttributeError: 'module' object has no attribute 'AF_INET'
> >>>
>
> Why? Thank you.

your Python installation is broken.  what OS are you using?





-- 
http://mail.python.org/mailman/listinfo/python-list


"import socket" error

2005-10-09 Thread [EMAIL PROTECTED]
Hi,

I am following this tutorial
https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=dw-linux-pysocks&S_TACT=105AGX59&S_CMP=GR&ca=dgr-lnxw07PythonSockets
( free reg. req. )

The article told me to do this:

[camus]$ python
Python 2.4 (#1, Feb 20 2005, 11:25:45)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more
   information.
>>> import socket
>>> socket.gethostbyname('www.ibm.com')
'129.42.19.99'
>>>

When I try it, I get this error:
>>> import socket
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.4/socket.py", line 1, in ?
# Wrapper module for _socket, providing some additional facilities
  File "/usr/lib/python2.4/SocketServer.py", line 274, in ?
class TCPServer(BaseServer):
  File "/usr/lib/python2.4/SocketServer.py", line 317, in TCPServer
address_family = socket.AF_INET
AttributeError: 'module' object has no attribute 'AF_INET'
>>>


Why? Thank you.

-- 
http://mail.python.org/mailman/listinfo/python-list


python socket error

2005-06-01 Thread Thomas Thomas



Is there any getaround for the following error 
..
This happens when uploading large files 
say>50MB..
 
Python version 
Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC 
v.1200 32 bit (Intel)] on win32Type "help", "copyright", "credits" or 
"license" for more information.
 
Traceback (most recent call last):  File 
"", line 1, in ?  File 
"c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/python-116V_Z.py", line 87, in 
?    
httpResult=httpUploadAsset('XX',filename,fileData)  File 
"c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/python-116V_Z.py", line 12, in 
httpUploadAsset    
results=post_multipart(theURL,"/UploaderHttp/",fields,files);  File 
"c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/python-116V_Z.py", line 30, in 
post_multipart    h.send(body)  File 
"C:\Python23\lib\httplib.py", line 579, in send    
self.sock.sendall(str)  File "", line 1, in 
sendallsocket.error: (10055, 'No buffer space available')
 
Any help
Thomas
 
 
--below the code sample that i am 
using
import osimport httplib, mimetypesimport 
os;def httpUploadAsset(serial,filename,data):    
_sessionID='xxx';    
_baseURL='http://xx.com'    fields = 
[('serial',serial),('sessionID',_sessionID)]    file = 
('file', filename, data)    files = 
[file]    
protocol,theURL=_baseURL.split('http://');    
results=post_multipart(theURL,"/UploaderHttp/",fields,files);    
print results;    return results;
 
def post_multipart(host, selector, fields, 
files):    """    Post fields and files to 
an http host as multipart/form-data.    fields is a sequence 
of (name, value) elements for regular form fields.    files 
is a sequence of (name, filename, value) elements for data to be uploaded as 
files    Return the server's response 
page.    """    content_type, body = 
encode_multipart_formdata(fields, files)    h = 
httplib.HTTP(host)    
h.set_debuglevel(0)    h.putrequest('POST', 
selector)    h.putheader('content-type', 
content_type)    h.putheader('content-length', 
str(len(body)))    h.endheaders()    
h.send(body)    errcode, errmsg, headers = 
h.getreply()    return h.file.read()
 
def encode_multipart_formdata(fields, 
files):    """    fields is a sequence of 
(name, value) elements for regular form fields.    files is a 
sequence of (name, filename, value) elements for data to be uploaded as 
files    Return (content_type, body) ready for httplib.HTTP 
instance    """     BOUNDARY = 
'--ThIs_Is_tHe_bouNdaRY_$'    CRLF = 
'\r\n'    L = []    for (key, value) in 
fields:    L.append('--' + 
BOUNDARY)    
L.append('Content-Disposition: form-data; name="%s"' % 
key)    
L.append('')    
L.append(value)    for (key, filename, value) in 
files:    L.append('--' + 
BOUNDARY)    
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, 
filename))    L.append('Content-Type: 
%s' % get_content_type(filename))    
L.append('')    
L.append(value)    L.append('--' + BOUNDARY + 
'--')    L.append('')    body = 
CRLF.join(L)
 
    content_type = 
'multipart/form-data; boundary=%s' % BOUNDARY    return 
content_type, body  def 
get_content_type(filename):    return 
mimetypes.guess_type(filename)[0] or 'application/octet-stream'
 
def getFileData(filename):    
try:    f = file(filename, 
"rb")    data = 
"">    
f.close()    except 
IOError:    return['ERR']
 
    return ['OK',data]
 
filepath="c:/Documents and 
Settings/Administrator/Desktop/tmp/TM_A5_Bulk.pdf"  #file with size 
>50MBfileResult=getFileData(filepath)filename='TM_A5_Bulk.pdf'fileData=Noneif 
(fileResult[0]=='OK'): 
fileData=fileResult[1];httpResult=httpUploadAsset('XX',filename,fileData)
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: socket error on windows, working fine on mac

2005-05-01 Thread Heiko Wundram
Am Montag, 2. Mai 2005 04:35 schrieb Thomas:
> I am getting socket error for large file transfer on windows (100MB+)

Get an operating system... :-)

No, seriously, I think that the problem might be that WinSock doesn't block 
the sending process while it can't send out the data. Thus: the internal 
send-buffer of WinSock overflows at some point when the receiver can't accept 
data as quickly as the sending process puts it in the queue and data starts 
to accumulate at the sending end.

You might try using select to make sure the socket is writable when sending 
data to it. select also works under Windows, but only on sockets.

This is all just an educated guess...

-- 
--- Heiko.
listening to: Rufus Wainwright - Hallelujah
  see you at: http://www.stud.mh-hannover.de/~hwundram/wordpress/


pgpV0biHZxTjJ.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

socket error on windows, working fine on mac

2005-05-01 Thread Thomas








I am getting socket error for large file transfer on windows
(100MB+) 

Working fine for files <50MB.

 

Everything is working fine on mac..

 

File "C:\Python23\lib\httplib.py", line 576, in
send

    self.sock.sendall(str)

  File "", line 1, in sendall

socket.error: (10055, 'No buffer space available')

 

 

cheers

Thomas

 

 

 

import httplib, mimetypes

 

def post_multipart(host, selector, fields, files):

    """

    Post fields and files to an http host as
multipart/form-data.

    fields is a sequence of (name, value) elements for
regular form fields.

    files is a sequence of (name, filename, value) elements
for data to be uploaded as files

    Return the server's response page.

    """

    content_type, body = encode_multipart_formdata(fields,
files)

    h = httplib.HTTP(host)

    h.set_debuglevel(0)

    h.putrequest('POST', selector)

    h.putheader('content-type', content_type)

    h.putheader('content-length', str(len(body)))

    h.endheaders()

    #print body;

    h.send(body)

    errcode, errmsg, headers = h.getreply()

    return h.file.read()

 

def encode_multipart_formdata(fields, files):

    """

    fields is a sequence of (name, value) elements for
regular form fields.

    files is a sequence of (name, filename, value) elements
for data to be uploaded as files

    Return (content_type, body) ready for httplib.HTTP
instance

    """

    BOUNDARY = '--ThIs_Is_tHe_bouNdaRY_$'

    CRLF = '\r\n'

    L = []

    for (key, value) in fields:

    L.append('--' + BOUNDARY)

    L.append('Content-Disposition: form-data;
name="%s"' % key)

    L.append('')

    L.append(value)

    for (key, filename, value) in files:

    L.append('--' + BOUNDARY)

    L.append('Content-Disposition: form-data;
name="%s"; filename="%s"' % (key, filename))

    L.append('Content-Type: %s' %
get_content_type(filename))

    L.append('')

    L.append(value)

    L.append('--' + BOUNDARY + '--')

    L.append('')

    body = CRLF.join(L)

    content_type = 'multipart/form-data; boundary=%s' %
BOUNDARY

    return content_type, body

 

def get_content_type(filename):

    return mimetypes.guess_type(filename)[0] or
'application/octet-stream'

 

 

import urllib2

import urllib2_file 

#URL = ''

FILE= 'c:/Documents and
Settings/Administrator/Desktop/TM_A5_Bulk.pdf';

f = file(FILE, "rb")

data = "">

f.close()

 

post_multipart("192.168.100.233","/UploaderHttp/",[('test','valTest')],[('FILE1','TM_A5_Bulk.pdf',data)]);






-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Socket Error

2005-04-14 Thread Matt

[EMAIL PROTECTED] wrote:
> Thanks everybody, it works now. I thought I needed to do something
like
> that but it didn't show it in the tutorial so I decided to ask here.

Where was the tutorial?  If it's in the Python docs, perhaps you could
submit a patch to fix it ... ;-)

M@

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket Error

2005-04-14 Thread kingofearth . com
Thanks everybody, it works now. I thought I needed to do something like
that but it didn't show it in the tutorial so I decided to ask here.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket Error

2005-04-14 Thread Achim Domma (Procoders)
[EMAIL PROTECTED] wrote:
NameError: name 'socket' is not defined
You forgot to import the socket module:
import socket
regards,
Achim
--
http://mail.python.org/mailman/listinfo/python-list


Re: Socket Error

2005-04-14 Thread [EMAIL PROTECTED]
You missed the import socket statement. Also the socket.PF_INET should
be socket.AF_INET

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket Error

2005-04-14 Thread Tiziano Bettio
[EMAIL PROTECTED] wrote:
When I try to open a socket with python i get the following error:
Traceback (most recent call last):
 File "./mailer", line 3, in ?
   sock = socket.socket(socket.PF_INET, socket.SOCK_STREAM)
NameError: name 'socket' is not defined
the code is:
#!/usr/bin/python
sock = socket.socket(socket.PF_INET, socket.SOCK_STREAM)
sock.connect(("mail.oasd.k12.wi.us", 25))
sock.send("HELO")
print sock.recv(8192)
sock.close()
 

tried:
import socket
???
--
http://mail.python.org/mailman/listinfo/python-list


Socket Error

2005-04-14 Thread kingofearth . com
When I try to open a socket with python i get the following error:

Traceback (most recent call last):
  File "./mailer", line 3, in ?
sock = socket.socket(socket.PF_INET, socket.SOCK_STREAM)
NameError: name 'socket' is not defined

the code is:

#!/usr/bin/python

sock = socket.socket(socket.PF_INET, socket.SOCK_STREAM)
sock.connect(("mail.oasd.k12.wi.us", 25))
sock.send("HELO")
print sock.recv(8192)
sock.close()

-- 
http://mail.python.org/mailman/listinfo/python-list