Exception handling for socket.error in Python 3.5/RStudio

Shaunak Bangale shaunak.bangale at gmail.com
Fri Feb 5 16:15:50 EST 2016

I do have the initiation command defined. Just that I am not allowed to
make the username, pwd public.

I am absolutely sure I am running the same code. Now opened the same file
with Python 3.5 shell and I get following error:

   from _ssl import RAND_status, RAND_egd, RAND_add
ImportError: cannot import name 'RAND_egd'

I am new to coding and this code has been borrowed from an online source
but I can see same code working on mac+Rstudio+python combo.

Salute your patience.


On Fri, Feb 5, 2016 at 2:01 PM, Martin A. Brown <martin at linux-ip.net> wrote:

> Hi there,
> >Thanks for the detailed reply. I edited, saved and opened the file
> >again. Still I am getting exactly the same error.
> >
> >Putting bigger chunk of code and the error again:
> [snipped; thanks for the larger chunk]
> >Error:
> >except socket.error as e:
> >                         ^
> >SyntaxError: invalid syntax
> I ran your code.  I see this:
>   $ python3 shaunak.bangale.py
>   Connecting...
>   Connection succeeded
>   Traceback (most recent call last):
>     File "shaunak.bangale.py", line 23, in <module>
>       ssl_sock.write(bytes(initiation_command, 'UTF-8'))
>   NameError: name 'initiation_command' is not defined
> Strictly speaking, I don't think you are having a Python problem.
>   * Are you absolutely certain you are (or your IDE is) executing
>     the same code you are writing?
>   * How would you be able to tell?  Close your IDE.  Run the code on
>     the command-line.
>   * How much time have you taken to work out what the interpreter is
>     telling you?
> Good luck,
> -Martin
> --
> Martin A. Brown
> http://linux-ip.net/

More information about the Python-list mailing list