Re: using smtp sent large file upto 60MB

2012-12-04 Thread moonhkt
On 12月5日, 下午1時34分, Chris Angelico wrote: > On Wed, Dec 5, 2012 at 11:54 AM, moonhkt wrote: > > I am prepare change UNIX script to Python. smtp and ftp are my first > > tasks. > > > But, when using standard unix command mail and uuencode without this > > issue. > > > Our SMTP can send file more th

How to check if Pexpect child already exist?

2012-12-04 Thread Thomas Elsgaard
Hi List I am wondering, how can i check if child already exist before i spawn ? child.isalive() cannot be done on child before it has been spawned. --- import pexpect child=pexpect.spawn('ssh mysurface@192.168.1.105') child.sendline('test') --- Thomas -- http://mail.python.org/mailman/listinfo

Re: using smtp sent large file upto 60MB

2012-12-04 Thread Chris Angelico
On Wed, Dec 5, 2012 at 11:54 AM, moonhkt wrote: > I am prepare change UNIX script to Python. smtp and ftp are my first > tasks. > > But, when using standard unix command mail and uuencode without this > issue. > > Our SMTP can send file more than 60MB. But our notes server can > configured 100MB,3

Re: How to determine if printing is being a bottleneck in my code?

2012-12-04 Thread rusi
On Dec 5, 7:36 am, Roy Smith wrote: > In article <29c74a30-f017-44b5-8a3d-a3c0d6592...@googlegroups.com>, > > > > > > > > > >  SherjilOzair wrote: > > Hello list, > > > When it comes to printing things while some computation is being done, there > > are 2 extremes. > > > 1. printing speed is slow

Re: How to determine if printing is being a bottleneck in my code?

2012-12-04 Thread Roy Smith
In article <29c74a30-f017-44b5-8a3d-a3c0d6592...@googlegroups.com>, SherjilOzair wrote: > Hello list, > > When it comes to printing things while some computation is being done, there > are 2 extremes. > > 1. printing speed is slower than data-to-print generation speed. In this > case, printi

Re: Python Cluster

2012-12-04 Thread subhabangalore
On Wednesday, December 5, 2012 2:33:56 AM UTC+5:30, Miki Tebeka wrote: > On Tuesday, December 4, 2012 11:04:15 AM UTC-8, subhaba...@gmail.com wrote: > > > >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y)) > > > but now I want to visualize it if any one suggest how may I use > > visuali

How to determine if printing is being a bottleneck in my code?

2012-12-04 Thread SherjilOzair
Hello list, When it comes to printing things while some computation is being done, there are 2 extremes. 1. printing speed is slower than data-to-print generation speed. In this case, printing is a bottleneck. Examples: "for i in xrange(2**30): print i". Without the print, this code would be m

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Nick Mellor
Hi Terry, For my money, and especially in your versions, despite several expert solutions using other features, itertools has it. It seems to me to need less nutting out than the other approaches. It's short, robust, has a minimum of symbols, uses simple expressions and is not overly clever. If

Re: using smtp sent large file upto 60MB

2012-12-04 Thread moonhkt
On 12月5日, 上午4時54分, Chris Angelico wrote: > On Wed, Dec 5, 2012 at 2:41 AM, Laszlo Nagy wrote: > > If you still don't want to accept this suggestion, then go ahead! Write a > > program, send out 100MB emails, and you will see for yourself that it just > > doesn't work. > > But be aware of a few th

Re: assign only first few items of a tuple/list

2012-12-04 Thread Tim Chase
On 12/04/12 15:36, Chris Angelico wrote: > On Wed, Dec 5, 2012 at 8:25 AM, Daniel Fetchinson > wrote: >> Hi folks, I swear I used to know this but can't find it anywhere. >> Say I have a list x = [ 1,2,3,4,5 ] and only care about the first two items. >> I'd like to assign the first two items to tw

Re: assign only first few items of a tuple/list

2012-12-04 Thread Dave Angel
On 12/04/2012 04:36 PM, Chris Angelico wrote: > On Wed, Dec 5, 2012 at 8:25 AM, Daniel Fetchinson > wrote: >> Hi folks, I swear I used to know this but can't find it anywhere. >> Say I have a list x = [ 1,2,3,4,5 ] and only care about the first two items. >> I'd like to assign the first two items

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Terry Reedy
On 12/4/2012 3:44 PM, Terry Reedy wrote: If the original string has no excess whitespace, description is what remains of s after product prefix is omitted. (Py 3 code) from itertools import takewhile def allcaps(word): return word == word.upper() def split_product_itertools(s): product =

Re: assign only first few items of a tuple/list

2012-12-04 Thread Terry Reedy
On 12/4/2012 4:36 PM, Chris Angelico wrote: On Wed, Dec 5, 2012 at 8:25 AM, Daniel Fetchinson wrote: Hi folks, I swear I used to know this but can't find it anywhere. Say I have a list x = [ 1,2,3,4,5 ] and only care about the first two items. I'd like to assign the first two items to two varia

Re: assign only first few items of a tuple/list

2012-12-04 Thread Chris Angelico
On Wed, Dec 5, 2012 at 8:25 AM, Daniel Fetchinson wrote: > Hi folks, I swear I used to know this but can't find it anywhere. > Say I have a list x = [ 1,2,3,4,5 ] and only care about the first two items. > I'd like to assign the first two items to two variables, something like, > > a, b, _ = x > >

assign only first few items of a tuple/list

2012-12-04 Thread Daniel Fetchinson
Hi folks, I swear I used to know this but can't find it anywhere. Say I have a list x = [ 1,2,3,4,5 ] and only care about the first two items. I'd like to assign the first two items to two variables, something like, a, b, _ = x but the above will not work, of course, but what is the common idiom

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Steven D'Aprano
Ian, For the sanity of those of us reading this via Usenet using the Pan newsreader, could you please turn off HTML emailing? It's very distracting. Thanks, Steven On Tue, 04 Dec 2012 12:37:38 -0700, Ian Kelly wrote: [...] > On Tue, > Dec 4, 2012 at 11:48 AM, Alexander Blinne < href="mailto

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Vlastimil Brom
2012/12/4 Nick Mellor : > I love the way you guys can write a line of code that does the same as 20 of > mine :) > I can turn up the heat on your regex by feeding it a null description or > multiple white space (both in the original file.) I'm sure you'd adjust, but > at the cost of a more compl

Re: Python Cluster

2012-12-04 Thread Miki Tebeka
On Tuesday, December 4, 2012 11:04:15 AM UTC-8, subhaba...@gmail.com wrote: > >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y)) > but now I want to visualize it if any one suggest how may I use > visualization(like matplotlib or pyplot etc.) to see the data? One option is to use a scatte

Re: Python Cluster

2012-12-04 Thread Ian Kelly
On Tue, Dec 4, 2012 at 12:04 PM, wrote: > Dear Group, > > I am trying to use the cluster module as, > >>> from cluster import * > >>> data = [12,34,23,32,46,96,13] > >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y)) > >>> cl.getlevel(10) > [[96], [46], [12, 13, 23, 34, 32]] > >>> cl.get

Re: using smtp sent large file upto 60MB

2012-12-04 Thread Chris Angelico
On Wed, Dec 5, 2012 at 2:41 AM, Laszlo Nagy wrote: > If you still don't want to accept this suggestion, then go ahead! Write a > program, send out 100MB emails, and you will see for yourself that it just > doesn't work. But be aware of a few things. 1) Converting 1MB of binary data into a MIME-p

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Terry Reedy
On 12/4/2012 8:57 AM, Nick Mellor wrote: I have a file full of things like this: "CAPSICUM RED fresh from Queensland" Product names (all caps, at start of string) and descriptions (mixed case, to end of string) all muddled up in the same field. And I need to split them into two fields. Note th

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Alexander Blinne
Am 04.12.2012 20:37, schrieb Ian Kelly: > >>> def split_product(p): > ... w = p.split(" ") > ... j = next(i for i,v in enumerate(w) if v.upper() != v) > ... return " ".join(w[:j]), " ".join(w[j:]) > > > It still fails if the product description is empty. That's true..

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread MRAB
On 2012-12-04 19:37, Ian Kelly wrote: On Tue, Dec 4, 2012 at 11:48 AM, Alexander Blinne mailto:n...@blinne.net>> wrote: Am 04.12.2012 19:28, schrieb DJC: (i for i,v in enumerate(w) if v.upper() != v).next() > Traceback (most recent call last): > File "", line 1, in

The Select Group- Raleigh, NC

2012-12-04 Thread Whitney Holman
PYTHON DEVELOPER NEEDED - EXCITING OPPORTUNITY IN MORRISVILLE, NC The Select Group is seeking a Python software engineer for fun, energetic, and growing company in Morrisville, NC. The ideal candidate will have hands-on development experience, and must have working knowledge of Python. A very

Re: [newbie] problem with usbtmc-communication

2012-12-04 Thread Terry Reedy
On 12/4/2012 7:14 AM, Jean Dubois wrote: The following test program which tries to communicate with a Keithley 2200 programmable power supply using usbtmc in Python does not work as expected. I have connected a 10 ohm resistor to its terminals and I apply 0.025A, 0.050A, 0.075A en 0.1A, I then me

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Ian Kelly
On Tue, Dec 4, 2012 at 11:48 AM, Alexander Blinne wrote: > Am 04.12.2012 19:28, schrieb DJC: > (i for i,v in enumerate(w) if v.upper() != v).next() > > Traceback (most recent call last): > > File "", line 1, in > > AttributeError: 'generator' object has no attribute 'next' > > Yeah, i saw

Re: Python Cluster

2012-12-04 Thread Dave Angel
On 12/04/2012 02:04 PM, subhabangal...@gmail.com wrote: > Dear Group, > > I am trying to use the cluster module as, from cluster import * No such module in the stdlib. Start by showing what OS, what Python version, and what external libraries you've installed and are using, and only then can

Python Cluster

2012-12-04 Thread subhabangalore
Dear Group, I am trying to use the cluster module as, >>> from cluster import * >>> data = [12,34,23,32,46,96,13] >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y)) >>> cl.getlevel(10) [[96], [46], [12, 13, 23, 34, 32]] >>> cl.getlevel(5) [[96], [46], [12, 13], [23], [34, 32]] but now I

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Alexander Blinne
Am 04.12.2012 19:28, schrieb DJC: (i for i,v in enumerate(w) if v.upper() != v).next() > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'generator' object has no attribute 'next' Yeah, i saw this problem right after i sent the posting. It now is supposed to read

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread DJC
On 04/12/12 17:18, Alexander Blinne wrote: Another neat solution with a little help from http://stackoverflow.com/questions/1701211/python-return-the-index-of-the-first-element-of-a-list-which-makes-a-passed-fun def split_product(p): w = p.split(" ") j = (i for i,v in enumer

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Neil Cerutti
On 2012-12-04, Nick Mellor wrote: > I love the way you guys can write a line of code that does the > same as 20 of mine :) > > I can turn up the heat on your regex by feeding it a null > description or multiple white space (both in the original > file.) I'm sure you'd adjust, but at the cost of a

paramiko.BadAuthenticationType

2012-12-04 Thread Theta Sigma
Hi, I'm trying to create a SSH connection with the paramiko module, and I'm running to this error... >> import os, paramiko >> ssh = paramiko.SSHClient() >> ssh.load_system_host_keys() >> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) >> ssh.connect('...',username='...',password='...')

Re: Working with classes

2012-12-04 Thread Jean-Michel Pichavant
- Original Message - > Hello, I've been working on this program for a long time but can't > seem to get it to work.. The first array is the input file, then a > class, another class and the actual program. Could anyone see what > is wrong? I'm sorry if the program doesn't make any sense at

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Alexander Blinne
Another neat solution with a little help from http://stackoverflow.com/questions/1701211/python-return-the-index-of-the-first-element-of-a-list-which-makes-a-passed-fun >>> def split_product(p): ... w = p.split(" ") ... j = (i for i,v in enumerate(w) if v.upper() != v).next() ... retu

Re: problem with usbtmc-communication

2012-12-04 Thread Jean Dubois
On 4 dec, 15:33, w...@mac.com wrote: > On Dec 4, 2012, at 7:14 AM, Jean Dubois wrote: > > > > > The following test program which tries to communicate with a Keithley > > 2200 programmable power supply using usbtmc in Python does not work as > > expected. I have connected a 10 ohm resistor to its t

Re: using smtp sent large file upto 60MB

2012-12-04 Thread Laszlo Nagy
Thank for suggestion. The next task will be ftp to user folder. But first tasks is how to using python send huge files. Most SMTP servers are configured not to accept attachments bigger than 10 or 15MB. In general, you should never send emails with >5MB attachments. Not because it is not possi

Re: New tutorials

2012-12-04 Thread Mitya Sirenef
On 12/02/2012 09:54 AM, Mitya Sirenef wrote: Hi everyone, I'm making a series of python tutorials and I've just finished the introductory part: http://lightbird.net/larks/intro.html Feedback is appreciated.. - mitya I've just added a new section 'block

Re: using smtp sent large file upto 60MB

2012-12-04 Thread moonhkt
On Dec 4, 6:07 pm, Chris Angelico wrote: > On Tue, Dec 4, 2012 at 7:15 PM, moonhkt wrote: > > How to using python send file uptp 60MB ? > > Step one: Don't. SMTP is almost never the best choice for sending huge > files around. > > There are plenty of other ways to share files; send an email with

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Neil Cerutti
On 2012-12-04, Nick Mellor wrote: > Hi Neil, > > Nice! But fails if the first word of the description starts > with a capital letter. Darn edge cases. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Nick Mellor
Hi Neil, Nice! But fails if the first word of the description starts with a capital letter. Nick On Wednesday, 5 December 2012 01:23:34 UTC+11, Neil Cerutti wrote: > On 2012-12-04, Nick Mellor wrote: > > > I have a file full of things like this: > > > > > > "CAPSICUM RED fresh from Queens

Re: CSV out of range

2012-12-04 Thread Anatoli Hristov
On Tue, Dec 4, 2012 at 2:58 PM, Neil Cerutti wrote: > On 2012-12-04, Anatoli Hristov wrote: >> The issue is now solved I did: >> >> for x in mylist: >> try: >> sku.append(x[4]) >> except IndexError: >> pass >> >> Thank you for your help > > Optionally: > > for x in mylist:

Re: [newbie] problem with usbtmc-communication

2012-12-04 Thread wrw
On Dec 4, 2012, at 7:14 AM, Jean Dubois wrote: > The following test program which tries to communicate with a Keithley > 2200 programmable power supply using usbtmc in Python does not work as > expected. I have connected a 10 ohm resistor to its terminals and I > apply 0.025A, 0.050A, 0.075A en 0

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Neil Cerutti
On 2012-12-04, Nick Mellor wrote: > I have a file full of things like this: > > "CAPSICUM RED fresh from Queensland" > > Product names (all caps, at start of string) and descriptions > (mixed case, to end of string) all muddled up in the same > field. And I need to split them into two fields. Note

Re: CSV out of range

2012-12-04 Thread Neil Cerutti
On 2012-12-04, Anatoli Hristov wrote: > The issue is now solved I did: > > for x in mylist: > try: > sku.append(x[4]) > except IndexError: > pass > > Thank you for your help Optionally: for x in mylist: if len(x) >= 4: sku.append(x[4]) But do you really need

Re: Conversion of List of Tuples

2012-12-04 Thread Neil Cerutti
On 2012-12-04, Hans Mulder wrote: > It's considered bad style to use map it you don't want the list it > produces. > >> There are more ways: >> > from operator import add > reduce(add, a) >> (1, 2, 3, 4) > > There's a built-in that does "reduce(operator.add"; it's called "sum": > sum

Re: CSV out of range

2012-12-04 Thread Anatoli Hristov
The issue is now solved I did: for x in mylist: try: sku.append(x[4]) except IndexError: pass Thank you for your help Anatoli -- http://mail.python.org/mailman/listinfo/python-list

Re: CSV out of range

2012-12-04 Thread Anatoli Hristov
On Tue, Dec 4, 2012 at 12:31 PM, Thomas Bach wrote: > Hi there, > > Please be a bit more precise… > > On Tue, Dec 04, 2012 at 12:00:05PM +0100, Anatoli Hristov wrote: >> >> The problem comes when I try to index the SKU array and the field is >> empty > > Can you provide an example for that? > >> a

[newbie] problem with usbtmc-communication

2012-12-04 Thread Jean Dubois
The following test program which tries to communicate with a Keithley 2200 programmable power supply using usbtmc in Python does not work as expected. I have connected a 10 ohm resistor to its terminals and I apply 0.025A, 0.050A, 0.075A en 0.1A, I then measure the current and the voltage en write

Re: scope, function, mutable

2012-12-04 Thread Jussi Piitulainen
gusa...@gmail.com writes: > What is the appropriate definition for the following behavior in > Python 2.7 (see code below). > > Both functions have assignment in it (like "x = ") so I assume, that > x is a local variable in both functions. It's a local variable in both functions because it's a fo

Re: Conversion of List of Tuples

2012-12-04 Thread Hans Mulder
On 4/12/12 10:44:32, Alexander Blinne wrote: > Am 03.12.2012 20:58, schrieb subhabangal...@gmail.com: >> Dear Group, >> >> I have a tuple of list as, >> >> tup_list=[(1,2), (3,4)] >> Now if I want to covert as a simple list, >> >> list=[1,2,3,4] >> >> how may I do that? > > Another approach that h

Re: scope, function, mutable

2012-12-04 Thread Thomas Bach
Hi, On Tue, Dec 04, 2012 at 02:55:44PM +0400, gusa...@gmail.com wrote: > What is the appropriate definition for the following behavior in Python 2.7 > (see code below). It has something to do with mutability of lists and that Python passes around references and not the actual objects. > > def f

Re: scope, function, mutable

2012-12-04 Thread Steven D'Aprano
On Tue, 04 Dec 2012 14:55:44 +0400, gusarer wrote: > What is the appropriate definition for the following behavior in Python > 2.7 (see code below). > Both functions have assignment in it (like "x = ") so I assume, that x > is a local variable in both functions. Well, yes, but that's not why x is

Re: CSV out of range

2012-12-04 Thread Thomas Bach
Hi there, Please be a bit more precise… On Tue, Dec 04, 2012 at 12:00:05PM +0100, Anatoli Hristov wrote: > > The problem comes when I try to index the SKU array and the field is > empty Can you provide an example for that? > and it seems that there I have empty array, I wanted to ignore the >

CSV out of range

2012-12-04 Thread Anatoli Hristov
Hello, I tried to read a CSV file with 3 products in it and index it into a list using file = open("ShopPrices.csv", "rbU") reader = csv.reader(file, delimiter=";") mylist = [] for x in reader: mylist.append(x) The problem comes when I try to index the SKU array and the field is empty

scope, function, mutable

2012-12-04 Thread gusarer
Hi, What is the appropriate definition for the following behavior in Python 2.7 (see code below). Both functions have assignment in it (like "x = ") so I assume, that x is a local variable in both functions. Also I thought this rule doesn't depend on WHERE in this function we find the assignment.

Re: using smtp sent large file upto 60MB

2012-12-04 Thread Chris Angelico
On Tue, Dec 4, 2012 at 7:15 PM, moonhkt wrote: > How to using python send file uptp 60MB ? Step one: Don't. SMTP is almost never the best choice for sending huge files around. There are plenty of other ways to share files; send an email with instructions on how to access the file, rather than at

Re: Conversion of List of Tuples

2012-12-04 Thread Alexander Blinne
Am 03.12.2012 20:58, schrieb subhabangal...@gmail.com: > Dear Group, > > I have a tuple of list as, > > tup_list=[(1,2), (3,4)] > Now if I want to covert as a simple list, > > list=[1,2,3,4] > > how may I do that? Another approach that has not yet been mentioned here: >>> a=[(1,2), (3,4)] >>>

Re: how to split the file into two sections....

2012-12-04 Thread Peter Otten
indu_shreen...@yahoo.co.in wrote: > Hi: > I have a text as > version comp X - aa > version comp Y - bbb > version comp Z -cc > > 12.12 Check for option 1 > > 12:13 Pass Test 1 > 12:14 verified bla bla bla > 12.15 completed > > 12.16 Fail Test 2 > 12:17 verified bla bla bla > 12.18 completed >

Re: Conversion of List of Tuples

2012-12-04 Thread Gary Herron
On 12/03/2012 11:58 AM, subhabangal...@gmail.com wrote: [(1,2), (3,4)] >>> L=[(1,2), (3,4)] >>> >>> [b for a in L for b in a] [1, 2, 3, 4] -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-lis

using smtp sent large file upto 60MB

2012-12-04 Thread moonhkt
Hi All How to using python send file uptp 60MB ? s = smtplib.SMTP("localhost") #~~ s.set_debuglevel(1) s.sendmail(from_addr, to_addr,m.as_string()) s.quit For 13MB file have below error s.sendmail(from_addr, to_addr,m.as_string()) File "/opt/freeware/lib/python2.6/email/message.py", line