Re: [Tutor] Limitation of int() in converting strings

2012-12-27 Thread eryksun
On Thu, Dec 27, 2012 at 12:13 PM, Oscar Benjamin wrote: > > I hadn't realised that. Does the int(obj) function use isinstance(obj, > str) under the hood? Yes. int_new and long_new use the macros PyString_Check (in 3.x PyBytes_Check) and PyUnicode_Check, which check the type's tp_flags. The C API

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Francois Dion
On Thu, Dec 27, 2012 at 8:48 AM, Ufuk Eskici wrote: > I got this output with lots of errors: > File "build\bdist.win32\egg\paramiko\auth_handler.py", line 311 > except SSHException, e: >^ > SyntaxError: invalid syntax Use Python 2.x, Python 3 is in the works, kindoff

Re: [Tutor] Limitation of int() in converting strings

2012-12-27 Thread Oscar Benjamin
On 27 December 2012 17:49, Steven D'Aprano wrote: > On 23/12/12 04:57, Oscar Benjamin wrote: >> >> On 22 December 2012 02:06, Steven D'Aprano wrote: >>> >>> On 18/12/12 01:36, Oscar Benjamin wrote: >>> I have often found myself writing awkward functions to prevent a rounding error from

Re: [Tutor] Limitation of int() in converting strings

2012-12-27 Thread Steven D'Aprano
On 23/12/12 04:57, Oscar Benjamin wrote: On 22 December 2012 02:06, Steven D'Aprano wrote: On 18/12/12 01:36, Oscar Benjamin wrote: I have often found myself writing awkward functions to prevent a rounding error from occurring when coercing an object with int(). Here's one: def make_int(obj)

Re: [Tutor] help

2012-12-27 Thread Alan Gauld
On 27/12/12 12:07, Randy WhiteWolf wrote: Phthon Programming for the Absolute Beginner by Michael Dawson. I have copied the code verbatim below. # Sound the system bell print "\a" > ... raw_input ("\n\nPress the enter key to exit.") My problem is I hear no system bell; the enter doesn't respon

Re: [Tutor] how to control putty window

2012-12-27 Thread Alan Gauld
On 27/12/12 10:32, Dave Angel wrote: Another comment: when starting a new thread, please use a fresh email to tutor@python.org. Don't use reply to an existing message, or your query can get lost in the noise. And of course pick a subject line that matches your query, like "Trouble importing

Re: [Tutor] Limitation of int() in converting strings

2012-12-27 Thread Oscar Benjamin
On 24 December 2012 04:42, eryksun wrote: > On Sat, Dec 22, 2012 at 12:57 PM, Oscar Benjamin > wrote: def make_int(obj): '''Coerce str, float and int to int without rounding error Accepts strings like '4.0' but not '4.1' ''' fnum = float('%s' % ob

Re: [Tutor] how to control putty window

2012-12-27 Thread ALAN GAULD
It looks like you have named your program paramiko.py? That is hiding the module. Try renaming your script. BTW its probavbly a bad idea to keepm Python scripts on the Desktop. Better to create a folder.   Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ >_

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Dave Angel
On 12/27/2012 06:44 AM, Ufuk Eskici wrote: First comment: please don't top-post. You've done it many times now, and it's not how this forum works. Put your comments after the parts you're quoting. (My email is mostly busted; I've been trying to send this for hours) First question: what vers

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Ufuk Eskici
I got this output with lots of errors: copying build\lib\paramiko\sftp_file.py -> build\bdist.win32\egg\paramiko copying build\lib\paramiko\sftp_handle.py -> build\bdist.win32\egg\paramiko copying build\lib\paramiko\sftp_server.py -> build\bdist.win32\egg\paramiko copying build\lib\paramiko\sftp_s

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Hugo Arts
On Thu, Dec 27, 2012 at 2:16 PM, Ufuk Eskici wrote: > This is the output, it fails. > > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] > on win32 > Type "copyright", "credits" or "license()" for more information. > >>> import paramiko > > Traceback (most recent call las

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Ufuk Eskici
This is the output, it fails. Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import paramiko Traceback (most recent call last): File "", line 1, in import paramiko ImportError: No modul

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Steven D'Aprano
On 27/12/12 23:33, Ufuk Eskici wrote: 2012/12/27 Steven D'Aprano On 27/12/12 22:44, Ufuk Eskici wrote: Traceback (most recent call last): File "C:\Users\eufuesk\Desktop\ufo.**py", line 1, in import paramiko ImportError: No module named paramiko Have you installed paramiko? It is

Re: [Tutor] help

2012-12-27 Thread Steven D'Aprano
On 27/12/12 23:07, Randy WhiteWolf wrote: # Sound the system bell print "\a" That comment is misleading. \a does not necessarily sound the system bell. Whether it does or not depends on the terminal you are using. For example, under Linux I am using the "Konsole" terminal, and I have four sett

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Ufuk Eskici
Yes, I've installed it. how can I check it? 2012/12/27 Steven D'Aprano > On 27/12/12 22:44, Ufuk Eskici wrote: > > Traceback (most recent call last): >>File "C:\Users\eufuesk\Desktop\ufo.**py", line 1, in >> import paramiko >> ImportError: No module named paramiko >> > > > Have you in

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Steven D'Aprano
On 27/12/12 22:44, Ufuk Eskici wrote: Traceback (most recent call last): File "C:\Users\eufuesk\Desktop\ufo.py", line 1, in import paramiko ImportError: No module named paramiko Have you installed paramiko? It is not a standard Python module, you have to install it first. -- Steven

[Tutor] help

2012-12-27 Thread Randy WhiteWolf
I am an older newbie teaching myself Python programming. I copied the code # Emonstrates escape sequences. This exercise is on page 22 of the Phthon Programming for the Absolute Beginner by Michael Dawson. I have copied the code verbatim below.       # Sound the system bell print "\a"   print "\

[Tutor] Trouble importing Paramiko

2012-12-27 Thread Ufuk Eskici
My code is: import paramiko ssh = paramiko.SSHClient() ssh.connect('710.10.10.10', username='ufuk', password='ufuk') and saved this file as "ufo.py" on the desktop. I'm still getting error: >>> RESTART >>> Traceback (most recent

Re: [Tutor] how to control putty window

2012-12-27 Thread Dave Angel
On 12/27/2012 04:53 AM, Ufuk Eskici wrote: > It seems it is looking for Paramiko under wrong folder. > import paramiko > Traceback (most recent call last): > File "", line 1, in > import paramiko > File "C:/Users/eufuesk/Desktop\paramiko.py", line 3, in > ssh = paramiko.SSHClient

Re: [Tutor] how to control putty window

2012-12-27 Thread Hugo Arts
On Thu, Dec 27, 2012 at 10:53 AM, Ufuk Eskici wrote: > It seems it is looking for Paramiko under wrong folder. > > >>> import paramiko > > Traceback (most recent call last): > File "", line 1, in > import paramiko > File "C:/Users/eufuesk/Desktop\paramiko.py", line 3, in > ssh = par

Re: [Tutor] how to control putty window

2012-12-27 Thread Ufuk Eskici
It seems it is looking for Paramiko under wrong folder. >>> import paramiko Traceback (most recent call last): File "", line 1, in import paramiko File "C:/Users/eufuesk/Desktop\paramiko.py", line 3, in ssh = paramiko.SSHClient() AttributeError: 'module' object has no attribute 'SSH

Re: [Tutor] how to control putty window

2012-12-27 Thread Alan Gauld
On 27/12/12 09:36, Ufuk Eskici wrote: I've installed Paramiko on my PC with Python 2.7. My code is: import paramiko import os ssh = paramiko.SSHClient() ssh.connect('10.10.10.10', username='ufuk', password='ufuk') Traceback (most recent call last): File "C:/Users/eufuesk/Desktop/paramiko.py

Re: [Tutor] how to control putty window

2012-12-27 Thread Ufuk Eskici
Hello, I've installed Paramiko on my PC with Python 2.7. My code is: import paramiko import os ssh = paramiko.SSHClient() ssh.connect('10.10.10.10', username='ufuk', password='ufuk') But I'm getting this error: >>> Traceback (most recent call last): File "C:/Users/eufuesk/Desktop/paramiko.py