Re: [Tutor] Logical Sorting [Off-Topic]

2006-07-09 Thread Alan Gauld
>> Or use 'ls -v'.  (I said it's "off topic" on the subject, sorry! 
>> It
>> might escaped you, but 'ls' _does_ have a proper sort by version.)
>>
>
> Which OS?

Most of them, its the GNU version of ls...

works on cygwin, linux, bsd, solaris

Alan G



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] keystroke via software

2006-07-09 Thread johnsonv3




Hi,
How can one make a networked Windows XP  
think a keystroke has been made every 13 minutes?  What would a 
python program to do this look like?
 
Thanks for your help.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] activestate

2006-07-09 Thread Daniel Watkins
Danny Yoo wrote:
> If it turns out that this is a good long-term solution, we'll change the
> links on the Tutor mailing list page from ActiveState's searchable archive
> to the one on gmane.

I've been using gmane for a few months now, without any problems.

Dan

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] keystroke via software

2006-07-09 Thread Alan Gauld
> How can one make a networked Windows XP
> think a keystroke has been made every 13 minutes?

I've never done it over a network but I have done it in Delphi.

The API function you need is:

PostMessage(hwnd, idMessage, wParam, lParam)

Post a message to a window.


Parameters

hwnd : int The hWnd of the window to receive the message.
idMessage : int  The ID of the message to post.
wParam : int The wParam for the message
lParam : int The lParam for the message

> What would a python program to do this look like?

Like I say I've never tried it from Python, but you need to
find a way to getb the handle of the window to which you
want to post the message. A tool like WinSpy will provide that info.

The Keypress messages are all defined in the API reference
material, there are subtle differences so check the docs.

Finally the wparam/lparams will depend on the actual
message you choose, aghain refer to the docs. BBut in
theory its a case of importing the win32 modules and
sending the message wiith a 15 second sleep() in between...

HTH,

Alan G. 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] error: (10054, 'Connection reset by peer')

2006-07-09 Thread Grady Henry



Here is a program that I wrote using the first 
example at 12.2.13 Examples at the www.python.org website,
 
# Import smtplib for the actual sending 
functionimport smtplib
 
# Import the email modules we'll needfrom 
email.MIMEText import MIMEText
 
# Open a plain text file for reading.  For 
this example, assume that# the text file contains only ASCII 
characters.fp = open('C:\Documents and 
Settings\User\Desktop\\text3.txt','rb')# Create a text/plain messagemsg 
= MIMEText(fp.read())fp.close()
 
# me == the sender's email address# you == the 
recipient's email addressmsg['Subject'] = 'The contents of %s' % 
'C:\Documents and Settings\User\Desktop\\text3.txt'msg['From'] = '[EMAIL PROTECTED]'msg['To'] = '[EMAIL PROTECTED]'
 
# Send the message via our own SMTP server, but 
don't include the# envelope header.s = 
smtplib.SMTP()s.connect()s.sendmail(me, [you], 
msg.as_string())s.close()
 
When I run the program using IDLE, I get the 
following message:
 
Traceback (most recent call last):  File 
"C:\Documents and Settings\User\Desktop\textsender.py", line 23, in 
?    s.connect()  File "C:\Python24\lib\smtplib.py", 
line 307, in connect    (code, msg) = 
self.getreply()  File "C:\Python24\lib\smtplib.py", line 348, in 
getreply    line = self.file.readline()  File 
"C:\Python24\lib\socket.py", line 340, in readline    data = 
"">error: (10054, 'Connection reset by 
peer')
 
What does this mean, and how can I fix 
it?
 
Grady Henry
[EMAIL PROTECTED]
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How to learn messages frim help()?

2006-07-09 Thread 韩宪平
Hi,all.For example,I want learn build-in function TYPE,do help(type)
and get message as following:

Help on class type in module __builtin__:

class type(object)
 |  type(object) -> the object's type
 |  type(name, bases, dict) -> a new type
 |
 |  Methods defined here:
 |
 |  __call__(...)
 |  x.__call__(...) <==> x(...)
 |
 |  __cmp__(...)
 |  x.__cmp__(y) <==> cmp(x,y)
 |
 |  __delattr__(...)
 |  x.__delattr__('name') <==> del x.name
 |
 |  __getattribute__(...)
 |  x.__getattribute__('name') <==> x.name
 |
 |  __hash__(...)
 |  x.__hash__() <==> hash(x)
..
Have TYPE defined these methods?
What relation with __call__,__cam__ etc?

Steve
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Splitting

2006-07-09 Thread Abhinav Gaurav
HI,     I was working on example of splitting using delimiter ;     Example :-  >>> a="43;dsds;d" >>> >>> b=a.split(';')     Here I encountered the following error :-     Traceback (innermost last):  File "", line 1, in ?AttributeError: 'string' object has no attribute 'split'     Can anybody help on resolving this issue?     Thanks  Abhinav 
		 
Try the all-new Yahoo! Mail . "The New Version is radically easier to use" – The Wall Street Journal___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Splitting

2006-07-09 Thread Daniel Watkins
Abhinav Gaurav wrote:
>   Example :-
>   >>> a="43;dsds;d"
 
 b=a.split(';')

>   Can anybody help on resolving this issue?

This is what it looks like on my computer:
>>> a="43;dsds;d"
>>> b=a.split(";")
>>> print b
['43', 'dsds', 'd']

This is using Python 2.4.2, though AFAI can recall this behaviour hasn't
changed in a while... Weird...

Sorry I couldn't be more help,
Dan

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Splitting

2006-07-09 Thread Abhinav Gaurav
Hi,     Thanks for your help! I am wondering if it works fine then why it failing on my comp. And what is the remedy for it?     Thanks  AbhinavDaniel Watkins <[EMAIL PROTECTED]> wrote:  Abhinav Gaurav wrote:> Example :-> >>> a="43;dsds;d"  b=a.split(';')> Can anybody help on resolving this issue?This is what it looks like on my computer:>>> a="43;dsds;d">>> b=a.split(";")>>> print b['43', 'dsds', 'd']This is using Python 2.4.2, though AFAI can recall this behaviour hasn'tchanged in a while... Weird...Sorry I couldn't be more help,Dan___Tutor maillist -
 Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor 
		 
Try the all-new Yahoo! Mail . "The New Version is radically easier to use" – The Wall Street Journal___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Splitting

2006-07-09 Thread John Fouhy
On 10/07/06, Abhinav Gaurav <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Thanks for your help! I am wondering if it works fine then why it failing on
> my comp. And what is the remedy for it?

What version of python are you running?

-- 
John.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Splitting

2006-07-09 Thread John Fouhy
On 10/07/06, Abhinav Gaurav <[EMAIL PROTECTED]> wrote:
> John Fouhy <[EMAIL PROTECTED]> wrote:
> > What version of python are you running?
> 1.5.2 is the version.

Right.  Well, you're slightly over 7 years out of date :-)  Do you
have the ability to upgrade?  You or your system administrator can
download the latest release from http://python.org/ -- python 2.4.3 is
the latest stable release.  You will probably find that much of what
you read on the web is incorrect for python 1.5.2.

-- 
John.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to learn messages frim help()?

2006-07-09 Thread Luke Paireepinart

> and get message as following:
[snip help output]
> Have TYPE defined these methods?
> What relation with __call__,__cam__ etc?
don't think you're supposed to actually deal with the class called 'type'.
I assume you're referring to typecasting variables.
What it means when it says 'type()' is, for example,
str( ), int( ) etc.

Take the following example.
 >>> a = 2
 >>> print a
2
 >>>print 'your number is '+a
TypeError: cannot concatenate str and int objects.
 >>>print 'your number is '+str(a)
your number is 2

note that you could just do
 >>> print 'your number is %s.' % a
your number is 2.

that will take care of the type conversion for you.

HTH,
Luke
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor