Re: How to jump out of nested 'for'-loops?

2009-09-28 Thread Sean DiZazzo
: >       print i*10 + j >       break # I want to jump out of the loops. > > Regards, > Peng Can you please give the people who answered your question a simple "thank you"?? ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: "Pipeline" Generator presentation - where?

2009-09-28 Thread Sean DiZazzo
On Sep 28, 9:12 pm, alex23 wrote: > Sean DiZazzo wrote: > > I remember reading (a few times) a presentation about using generators > > to create "pipelines"  The idea was to create very specific and small > > generator functions, and then combine them together

Re: the usage of 'yield' keyword

2009-10-15 Thread Sean DiZazzo
On Oct 13, 6:41 pm, Peng Yu wrote: > http://docs.python.org/reference/simple_stmts.html#grammar-token-yiel... > > The explanation of yield is not clear to me, as I don't know what a > generator is. I see the following example using 'yield'. Could > somebody explain how 'yield' works in this exampl

Re: the usage of 'yield' keyword

2009-10-15 Thread Sean DiZazzo
On Oct 15, 9:48 pm, Sean DiZazzo wrote: > On Oct 13, 6:41 pm, Peng Yu wrote: > > >http://docs.python.org/reference/simple_stmts.html#grammar-token-yiel... > > > The explanation of yield is not clear to me, as I don't know what a > > generator is. I see the follow

ftplib connection fails with multiple nics

2009-10-16 Thread Sean DiZazzo
le "ftplib.pyo", line 131, in connect File "socket.pyo", line 498, in create_connection gaierror: [Errno 10093] getaddrinfo failed I think it is because of the two nics, because the code runs fine on other machines. Any ideas on how to fix this? TIA. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib connection fails with multiple nics

2009-10-17 Thread Sean DiZazzo
On Oct 16, 4:51 pm, Sean DiZazzo wrote: > Hi all, > > I'm trying to connect to an ftp site from a windows machine with two > nics going to two different networks, but I keep getting the below > exception: > > Traceback (most recent call last): >   File "ftp.

Re: ftplib connection fails with multiple nics

2009-10-20 Thread Sean DiZazzo
On Oct 19, 10:23 pm, Tim Roberts wrote: > Sean DiZazzo wrote: > > >I'm trying to connect to an ftp site from a windows machine with two > >nics going to two different networks, but I keep getting the below > >exception: > > >Traceback (most recent call l

Re: ftplib connection fails with multiple nics

2009-10-20 Thread Sean DiZazzo
On Oct 19, 10:23 pm, Tim Roberts wrote: > Sean DiZazzo wrote: > > >I'm trying to connect to an ftp site from a windows machine with two > >nics going to two different networks, but I keep getting the below > >exception: > > >Traceback (most recent call l

Re: Pause a thread/ execfile()

2009-10-26 Thread Sean DiZazzo
sets and unsets the event, and the worker will find out and pause at the next iteration. Depending on what kind of work your worker thread is doing, it might be tough to structure the code so the event gets checked reasonably often. Hope this helps. ~Sean PS. Not sure this idea will hold up when using execfile() -- http://mail.python.org/mailman/listinfo/python-list

Re: Pause a thread/ execfile()

2009-10-26 Thread Sean DiZazzo
On Oct 26, 1:25 am, Babloo wrote: > On Oct 26, 1:01 pm, Sean DiZazzo wrote: > > > > > On Oct 25, 11:58 pm, Babloo wrote: > > > > i have a small python application with GUI (frontend) which has > > > various functions. I have a "RUN" button which

Re: popen function of os and subprocess modules

2009-10-28 Thread Sean DiZazzo
o move into a folder and then need to execute some > shell commands(make etc.) in that folder. I just gave 'ls' for the > sake of an example. The real problem I am facing is, how to stay in > the folder after popen('cd directory') finishes. It seems trivial, but > I am not able to do it. > > Varun Use subprocess.Popen() with it's "cwd" argument. Something like: import subprocess p = subprocess.Popen(["ls","-l"] stdout=subprocess.PIPE, cwd="/etc") print p.stdout.read() ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: ImportError: No module named _md5 - Please help

2009-10-29 Thread Sean DiZazzo
nd there is a _md5.so that it uses but cant find. Not sure about that. Did you write the code above? Or did you find it inside another file? If you found it inside another file what is the file? If you still have questions, I have another approach. Please cover your palm and fingers with a thick layer of black ink (making sure to cover your entire hand). Press your hand down firmly on a piece of bright white paper. Allow the ink to dry. Finally, scan the page and post it here. I will attempt to read your palm to find the answer. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: How to avoid certain directories when using os.walk?

2009-10-30 Thread Sean DiZazzo
ete from a tree while ignoring certain named directories. Directories must be empty before they can be deleted, so you must use "topdown=False", but to prune a search you must use "topdown=True". At least I think that was the problem I had with my deletion script a while back. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

chr / ord

2009-11-02 Thread Sean McIlroy
hello how do i say "chr" and "ord" in the new python? the functions below (which work in 2.6.6) show what i'm trying to do. thanks if you can help. def readbytes(filepath): return [ord(x) for x in open(filepath,'rb').read()] def writebytes(numbers,filepath): open(filepath,'wb').write(''.

Re: substituting list comprehensions for map()

2009-11-02 Thread Sean DiZazzo
On Nov 2, 9:01 pm, Ben Finney wrote: > Anh Hai Trinh writes: > > > > Yes, just about any ‘map()’ operation has a corresponding list > > > comprehension. (Does anyone know of a counter-example, a ‘map()’ > > > operation that doesn't have a correspondingly simple list > > > comprehension?) > > > Tr

Re: chr / ord

2009-11-03 Thread Sean McIlroy
thanks. that did the trick. in case anyone else is in the same boat as myself, here are the relevant correspondences: string <-> [int] bytes <-> [int] --- -- lambda string: [ord(x) for x in string] list lambda ints: ''.join([chr(x

Re: extracting info from media files

2009-11-07 Thread Sean DiZazzo
MediaInfo is your best bet. http://mediainfo.sourceforge.net/en ~Sean On Nov 6, 11:59 pm, Michele Simionato wrote: > I would like to extract some simple info from media files, such as > size, resolution, duration, codec. What's the simplest way to do it? > Once in a time there w

midi file parser

2009-11-23 Thread Sean McIlroy
""" A Sequence is a list [FormatType, TimeDivision, Tracks] where *) FormatType is in [0,1,2] *) TimeDivision is either [TicksPerBeat] with TicksPerBeat in range (2**15) or [FramesPerSecond, TicksPerFrame] with FramesPerSecond in range (2**7) and TicksPerFrame in range(2**8) *) Tracks is a

Re: PEP 3147 - new .pyc format

2010-01-31 Thread Sean DiZazzo
> Here is a recent list of magic numbers: > >        Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode) >        Python 2.6a1: 62161 (WITH_CLEANUP optimization) >        Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND) >        Python 2.7a0: 62181 (optimize cond

Re: Your beloved python features

2010-02-04 Thread Sean DiZazzo
ed python features. > > So, may you help me please? If there's a similar thread/blogpost/ > whatever, please give it to me, google couldn't. > > Regards > Julian I love list comprehensions, but am currently falling for 'with'. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: equivalent of Ruby's Pathname?

2010-02-04 Thread Sean DiZazzo
ls addition to the lib that > provides this level of convenience...) > > There was also a PEP with another possible > implementation:http://www.python.org/dev/peps/pep-0355/ > > Hope this helps. It's too bad that something like this can't be agreed to. I used a homegrown module like this for a couple of years in my early days with python. It was great, but I didn't know enough at the time to make it really useful. Why did Path() get rejected? Is it the idea itself, or just the approach that was used? What are the complaints? ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing Commands From Windows Service

2010-02-07 Thread Sean DiZazzo
best way around this?  Thanks! Try running/debugging your service from the commandline as " debug" That should lead you to the error. Otherwise, we need to see a traceback and some code to be better able to help. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing Commands From Windows Service

2010-02-07 Thread Sean DiZazzo
take a look at paramiko as the ssh client library? I think it runs under windows. Also perhaps Twisted has something. Either way would be light years ahead of using subprocess with plink. Just my thoughts. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing Commands From Windows Service

2010-02-08 Thread Sean DiZazzo
> > It's working fine when I run it via " debug" - that's how > I was testing before.  It's when I start the service that it fails - > and you can see that, when you run it with debug, plink.exe runs under > my username.  When I run it as a service, it runs under System... You can have the servic

Re: Executing Commands From Windows Service

2010-02-09 Thread Sean DiZazzo
On Feb 9, 6:52 am, T wrote: > On Feb 8, 2:25 pm, David Bolen wrote: > > > > > T writes: > > > I have a script, which runs as a Windows service under the LocalSystem > > > account, that I wish to have execute some commands.  Specifically, the > > > program will call plink.exe to create a reverse

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Sean DiZazzo
On Feb 8, 2:36 pm, a...@pythoncraft.com (Aahz) wrote: > In article > , > Sean DiZazzo   wrote: > > >On Feb 3, 6:08=A0pm, alex23 wrote: > > >> There was also a PEP with another possible implementation: > >>http://www.python.org/dev/peps/pep-0355/ > >

Re: How do you implement a Progress Bar

2010-02-13 Thread Sean DiZazzo
ttp://uucode.com/texts/pylongopgui/pyguiapp.html ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about getmtime

2010-02-19 Thread Sean DiZazzo
e is updated, so changing permissions, among other things will update it. It blew me away when I finally found this out. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Executable problem - correction

2010-02-24 Thread Sean DiZazzo
ilt (and where > it > runs OK) is using Vista.  I now see that it will probably be necessary to > build > separate Vista and XP versions - I should have realized this earlier, but was > misled by the fact that the Vista-built program runs OK on my XP SP2 box. Did you compile

Re: Updates about Tk

2010-02-27 Thread Sean DiZazzo
> Are the new Tk comaprable with other toolkits(Qt, GTK,Wx?)? > Does Tk lack other features compared to the Qt,GTK,Wx...? > (Or: is there things you can't simply do with Tk?) > > Thanks in advance for replying tkinter is a good starting point. You can get some definite benefits going to wx or Qt

Re: MySQLdb compiled -- Import issue

2010-03-24 Thread Sean DiZazzo
ViewDownload > >  signature.asc > < 1KViewDownload The warning looks familiar. Are you running python from the MySQLdb source directory? ie. /opt/downloads/py-modules/MySQL-python-1.2.3c1 I think you just need to change directories and the warning will go away. Check what's happening on line 3 of _mysql.py I don't have the source in front of me. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb compiled -- Import issue

2010-03-24 Thread Sean DiZazzo
> You are right. I was trying to import the module sitting on the source > folder :"-). Thanks for your quick response and let me try further. Sweet! I remember it because it confused the hell out of me on at least one past occasion. :) -- http://mail.python.org/mailman/listinfo/python-list

Help with threading.local use in python-memcache module.

2010-12-17 Thread Sean Reifschneider
ading.local, in case anyone is relying on it now that it's in there. But I'd like to offer a solution for the cases where it doesn't work. Any suggestions on the solution for this? Thanks, Sean -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comm

Re: getopt question

2010-04-09 Thread Sean DiZazzo
7;Invalid option' >     sys.exit(0) If your argument is expecting a value, you need to add a colon after it in the argument string. ie. 'a:b:' Guessing if you print 'args' from your example, both the -c and junk1 will be in there. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

win32wnet.WNetAddConnection2 to specific network interface?

2010-04-14 Thread Sean DiZazzo
to force the connection to go to a specific interface? I'll post the exact error after I can get on that machine. Thanks! ~Sean I'm using this wnet_connect() function that I found somewhere. It works perfectly except on this one machine. def wnet_connect(self, host, username, p

Re: win32wnet.WNetAddConnection2 to specific network interface?

2010-04-14 Thread Sean DiZazzo
On Apr 14, 9:22 pm, Dennis Lee Bieber wrote: > On Wed, 14 Apr 2010 15:18:11 -0700 (PDT), Sean DiZazzo > declaimed the following in > gmane.comp.python.general: > > > > >     def wnet_connect(self, host, username, password): > >         The presence of "self&q

Re: client to upload big files via https and get progress info

2010-05-13 Thread Sean DiZazzo
avenue to read the size of the file on the server. Maybe a webservice that you call with the name of the file that returns it's percent complete, or it could just return bytes on disk and you do the math on the client side. Then you just forget about the transfer and query the file size whenever you want to know...or on a schedule. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: client to upload big files via https and get progress info

2010-05-13 Thread Sean DiZazzo
On May 13, 9:54 pm, Sean DiZazzo wrote: > On May 13, 9:39 am, News123 wrote: > > > > > Hi Aaaz, > > > Aahz wrote: > > > In article <4bea6b50$0$8925$426a7...@news.free.fr>, > > > News123   wrote: > > >> I'd like to perform huge f

Re: recursively remove all the directories and files which begin with '.'

2010-05-16 Thread Sean DiZazzo
an-up-a-directory-tree/ "Although it is true you can use shutil.rmtree() in many cases, there are some cases where it does not work. For example, files that are marked read-only under Windows cannot be deleted by shutil.rmtree(). By importing the win32api and win32con modules from PyWin32

Re: Drilling down in a dict with "complex" objects

2010-05-24 Thread Sean DiZazzo
On May 24, 9:34 pm, Six wrote: > I am trying to access an objects sub-object attributes. I can boil the > code I am working with down to this problem section: > (snip) > class Pt: >   x = None >   y = None >   def __init__(self, x, y): >     self.x, self.y = x, y >   pass > > class Pts: >   curr_p

including pygments code_block directive in rst2* from docutils

2010-06-10 Thread Sean Davis
file to bother html and pdf (via latex). Any suggestions? Thanks, Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-13 Thread Sean DiZazzo
On Jun 13, 4:39 pm, Vincent Davis wrote: > On Sun, Jun 13, 2010 at 5:28 PM, Gerry Reno wrote: > > sounds like your keymapping got messed with. > > > you could just: > > set -o vi > > python > > ESC, Ctrl-j > > and now ESC-k and ESC-j will take you back and forth in history (std vi > > editing) >

Re: Help with suds: HTTP Error 401

2010-06-19 Thread Sean DiZazzo
.HTTPBasicAuthHandler(t.pm) t.urlopener = urllib2.build_opener(t.handler) c = client.Client(url='http://xxx.xxx.xxx.xxx/path/to? WSDL',transport=t) ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread Sean McIlroy
i think what he means is to put the global declaration inside the function that assigns to filename: def open_file_dialog(): global filename filename = tkFileDialog.askopenfilename(filetypes= [("allfiles","*")]) as it was, the function was creating a new variable called filename and assi

Re: shutil.rmtree raises "OSError: [Errno 39] Directory not empty" exception

2009-07-12 Thread Sean DiZazzo
n for. Check this page, and see comment #3: http://code.activestate.com/recipes/193736/ I guess if the file is marked as "Read Only" or "Archive", or whatever, it cannot be deleted with shutil.rmtree() The key: win32api.SetFileAttributes(path, win32con.FILE_ATTRIBUTE_NORMAL) It will work! ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Free hosting for open source Python projects

2009-07-27 Thread Sean Kemplay
ebsite is located at www.pythonicity.co.uk if you want to see what we do. Best Regards, Sean Kemplay -- http://mail.python.org/mailman/listinfo/python-list

Re: basic thread question

2009-08-19 Thread Sean DiZazzo
rtinhttp://www.pizzashack.org/ > > GPG Key ID: 0x81CFE75D > > >  application_pgp-signature_part > > < 1KViewDownload > > I would still watch that video which will explain a bit more about the > GIL. Thank you for the video! It's good to know, but it raises lots of other questions in my mind. Lots of examples would have helped. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Permanently adding to the Python path in Ubuntu

2009-08-29 Thread Sean DiZazzo
ript): import sys sys.path[0] = "/usr/local/lib/python2.6/dist-packages" import numpy PS. Say hi to Steven for me! ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: connect to ms sql server with odbc

2009-08-30 Thread Sean DiZazzo
with two different editors? Tabs are not equal to spaces. Go thru your code and be sure that you are consistent with all of your spacing. I believe 4 spaces per indent (without tabs) is the current Python standard. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: python daemon - compress data and load data into MySQL by pyodbc

2009-09-02 Thread Sean DiZazzo
gt; I am a python newbie. > > Thanks for all the help I can get, Start by reading the tutorial. http://docs.python.org/tutorial/ ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: string find mystery

2009-09-02 Thread Sean DiZazzo
So, no matter what you do, string.find() will evaluate to "True" You could use it like this: if file_str.find("Geometry") != -1: but you probably want to use: if "Geometry" in file_str: ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Usage of main()

2009-09-03 Thread Sean DiZazzo
sting ground, and a sort of loose documentation for my modules. I put stuff in there that shows and tests a general use of the module, but when I actually import and use it, I definitely don't want that code to run! What are you using to test the scripts? I could be completely wrong, but I find it hard to believe that the second version is much (if any) faster than the first. Then again, I don't know much about the internals... ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Usage of main()

2009-09-04 Thread Sean DiZazzo
On Sep 3, 11:55 pm, alex23 wrote: > Sean DiZazzo wrote: > > What are you using to test the scripts?  I could be completely wrong, > > but I find it hard to believe that the second version is much (if any) > > faster than the first.  Then again, I don't know mu

Compiler.ast helper function "literal_eval" in python 2.4

2009-09-04 Thread Sean Talts
restricted to using 2.4. I was wondering if there was some way programmers performed this way back when? Thanks, Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: pexpect and unicode strings

2009-09-04 Thread Sean DiZazzo
os.write(self.child_fd, s) > UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in > position 41: ordinal not in range(128) > > > > Help appreciated! > > cheeers > Mat Did you trying changing line 953 in the pexpect file to: c = os.write(self.child_fd, s.encode("utf-8")) and then run your code again? Worth a shot. I have no good way of trying it out here. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

midi file toolkit

2009-09-05 Thread Sean McIlroy
## python 2.6.2 from tkFileDialog import askopenfilename, askdirectory def nowindow(function): def windowless(): from Tkinter import Tk Tk().withdraw() return function() return windowless getfilename = nowindow(askopenfilename) getdirectoryname = nowindow(askdirec

Re: simple string question

2009-09-06 Thread Sean DiZazzo
fi = open(path_to_file, 'r') for line in fi: process_line(line) ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange effects using the email.message.Message class

2009-09-08 Thread Sean DiZazzo
ote, I would be very happy, as I would like to improve > my > Python-fu (which is minimal, unfortunately). > > Thanks in advance, Rogério Brito. > > -- > Rogério Brito : rbr...@{mackenzie,ime.usp}.br : GPG key > 1024D/7C2CAEB8http://www.ime.usp.br/~rbrito:http://meusite.mackenzie.com.

Re: Python SSH interface

2009-09-10 Thread Sean DiZazzo
eek. It *is* a Google issue. The first hit mentions: pyssh paramiko pexpect + pxssh with opinions of each. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Message box always appears on 2nd monitor

2009-09-11 Thread Sean DiZazzo
.SetPosition( (0, 0) ) >          wx.MessageBox(message='Connect Error', >                       caption='Status', >                       style=wx.OK | wx.ICON_EXCLAMATION| wx.CENTER, >                       x=0, y=0) Did you try making the message box a child of whatever windo

Re: Why indentation is use to denote block of code?

2009-09-13 Thread Sean DiZazzo
f using indentation to denote a block of code is > that the runtime to automatically indent a python code would be about > a few times more than the runtime to automatically indent a C++ code > of the same length (both are in vim). > > Regards, > Peng Try this: from __future_

Re: Why indentation is use to denote block of code?

2009-09-13 Thread Sean DiZazzo
micolons? I suggest you spend some time just programming it the way it was made to be programmed, and quit trying to turn it into Perl or any other language. If after a week or two, you don't like it, then move on. And save us the complaints. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: run exe on different computer

2009-09-13 Thread Sean DiZazzo
that call external programs.) The return values (when available) are sent back to the client. I think that the call to the xmlrpc from the client blocks until the remote call is finished. (Not positive) So, if you need, you can set up the server class with a "poll()" method, call the xmlrpc method in a separate thread, and poll it until you know its done. Another idea... I use heartbeats to tell if a daemon/service is still running. Check: http://code.activestate.com/recipes/52302/ Set up a heartbeat server somewhere, and then set up the client portion in your windoze service. I have the server write it's up/down status to a database, and then I can read the status of lots of daemons from anywhere I want. If you are looking to monitor alot of daemons/services that are installed on several machines, heartbeats are the way to go. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Sean DiZazzo
tion program that you are using?? Please show us the point you are trying to make in something more valuable. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Sean DiZazzo
t angry. __main__ doesn't exist because it is not in your programs scope. you are looking for: if __name__ == "__main__": print "Hello World" ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Why use "locals()"

2009-09-13 Thread Sean DiZazzo
I have never used a call to "locals()" in my code. Can you show me a use case where it is valuable and Pythonic? ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
On Sep 13, 8:18 pm, Steven D'Aprano wrote: > On Sun, 13 Sep 2009 20:06:51 -0700, Sean DiZazzo wrote: > > I have never used a call to "locals()" in my code.  Can you show me a > > use case where it is valuable and Pythonic? > > grep is your friend: > >

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
): >              self.r, self.g, self.b = rgb >          def fget(self): >              return (self.r, self.g, self.b) >          return property(**locals()) > So really it's just a short hand. But it's against the Zen! Explicit not Implicit! I'm not convincedthen again, I didn't look at the source code of the standard libraries. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
On Sep 13, 9:11 pm, Steven D'Aprano wrote: > On Sun, 13 Sep 2009 20:26:06 -0700, Sean DiZazzo wrote: > > On Sep 13, 8:18 pm, Steven D'Aprano > > wrote: > >> On Sun, 13 Sep 2009 20:06:51 -0700, Sean DiZazzo wrote: > >> > I have never used a cal

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
orcing you. It's a pretty small domain, but I see the use (and the Pythonicity). Thanks all for your advice. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: overrideredirect vs. text entry etc. widget

2009-09-15 Thread Sean DiZazzo
rect(True) root.withdraw() root.deiconify() Entry(root).pack() Button(root, text='Override', command=override).pack() root.mainloop() ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: overrideredirect vs. text entry etc. widget

2009-09-16 Thread Sean DiZazzo
On Sep 15, 10:20 pm, kernus wrote: > On Sep 15, 11:42 am, Sean DiZazzo wrote: > > > > > Whats interesting is that if you call overrideredirect from a button > > command, it works as expected.  Well, at least the text entry field > > ^so, Sean, you

Re: Granularity of OSError

2009-09-18 Thread Sean DiZazzo
short term.) > > TIA! > > kynn You can access the exception object which gives you greater detail. try: os.unlink(some_file) except OSError, e: print e.errno print e.strerror if e.errno == 2: pass else: raise If it's the error you are looking for, handle it, or else raise. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Why use "locals()"

2009-09-18 Thread Sean DiZazzo
On Sep 18, 9:55 am, Simon Forman wrote: > On Mon, Sep 14, 2009 at 1:12 AM, Sean DiZazzo wrote: > > > Thanks for your explanation Steven.  I see how it can be valuable, but > > it seems to always break the second rule of Zen.  I don't really want > > to get into the c

Re: Creating a local variable scope.

2009-09-18 Thread Sean DiZazzo
conventions to maximize readability for these > cases in python? (Execution time is not important in the cases I > currently consider.) > > Regards > > Johan I would do something like this: >>> class Namespace(object): ... pass ... >>> n = Namespace() >

Re: Granularity of OSError

2009-09-18 Thread Sean DiZazzo
to unlink(). > > Christian Thanks for pointing that out. I never thought of it before. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: control CPU usage

2009-09-19 Thread Sean DiZazzo
On Sep 19, 9:17 am, kakarukeys wrote: > Hi, > > When I am running a loop for a long time, calculating heavily, the CPU > usage > is at 100%, making the comp not so responsive. Is there a way to > control the > CPU usage at say 80%? putting a time.sleep(0.x) doesn't seem to help > although CPU usag

Re: easy question, how to double a variable

2009-09-21 Thread Sean DiZazzo
On Sep 21, 1:46 pm, daggerdvm wrote: > u don't want to answerthen why post?...get lost. I eat children... -- http://mail.python.org/mailman/listinfo/python-list

Re: using python 2.5

2009-09-21 Thread Sean DiZazzo
the modules, and some might work, but it's crap shoot. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I tell if variable is defined

2009-09-22 Thread Sean DiZazzo
var except NameError: handle_it() ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-22 Thread Sean DiZazzo
essing it into another DB anyway, so I imagine you could do both things at the same time. This could very probably be handled in a different way if you are a DBA. I'm just a MySQL hack. :) ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Open file on remote linux server

2009-09-23 Thread Sean DiZazzo
t; Sent from the Python - python-list mailing list archive at Nabble.com. I don't know of any Python library that will give you that kind of access to a remote file over ssh. It sounds like a fun project though! If nothing else, you can install the ssh filesystem for Fuse, and just moun

Re: Searching a large dictionary

2009-09-23 Thread Sean DiZazzo
ork on the 'sec' field, since it's a number rather > than a string. > > -- > Rhodri James *-* Wildebeest Herder to the Masses I like to perform what I call "objectify" on nested dictionary type stuff into classes. class TestPart(object): def __init__(self, **kwargs): for k,v in kwargs.items(): setattr(self, k, v) class Test(object): def __init__(self): self.name = None self.entries = [] def set(self, name, listofdicts): self.name = name for l in listofdicts: self.entries.append(TestPart(**l)) def search(self, key, value): rets = [] for t in self.entries: if value in getattr(t, key): rets.append(t) return rets if __name__ == "__main__": d = {'252': [{'code': '51679', 'date': '2009-08-01 11:35:38', 'userfield': '252', 'from': '9876662881', 'to': '19877760406', 'fpld': '"Foobar" <9855562881>', 'result': 'ANSW', 'sec': 131}, {'code': '51679', 'date': '2009-08-01 14:33:55', 'userfield': '252', 'from': '9876662881', 'to': '1980391', 'fpld': '"Foobar" <9876555881>', 'result': 'ANSW', 'sec': 86}]} items = [] for k, v in d.items(): t = Test() t.set(k, v) items.append(t) for i in items: got = i.search("code", "9") print got for r in got: print r.code It's not quite right, but you get the basic idea. I just find it easier to wrap my head around structures built like this rather than trying to remember alot of inner/outer, index variables, etc. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Date using input

2009-09-24 Thread Sean DiZazzo
a string  efgh-cd-ab.log   which you will then create as a text > > > file.  And if the file exists, you'll append to it instead of > > > overwriting it.   Can you do that much? > > > > DaveA > > > Trying but haven't got it working, thats why I started

Re: PExpect on Windows System Using Cygwin

2009-09-24 Thread Sean DiZazzo
at I can copy with it or anything so that it works without > > having to install cygwin on the server that will be hosting this scheduled > > task? > > > Thanks for any help. > > > Kevin > > Why not just use the subprocess module?   It's built into the Windows > distribution, and doesn't need cygwin. > > DaveA Can subprocess pass things like passwords to running processes like pexpect can? ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Poll: Do you use csv.Sniffer?

2009-09-24 Thread Sean DiZazzo
.@pobox.com -http://www.smontanaro.net/ >     Getting old sucks, but it beats dying young How do I mark the boxes?? ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode Support in Ruby, Perl, Python, Emacs Lisp

2010-10-09 Thread Sean McAfee
Xah Lee writes: > Perl's exceedingly lousy unicode support hack is well known. In fact > it is the primary reason i “switched” to python for my scripting needs > in 2005. (See: Unicode in Perl and Python) I think your assessment is antiquated. I've been doing Unicode programming with Perl for ab

how do I search python mailing list archives?

2010-10-13 Thread Sean Choi
What are the various ways to search the python mailing list archives? -- http://mail.python.org/mailman/listinfo/python-list

functions, list, default parameters

2010-10-21 Thread Sean Choi
I found two similar questions in the mailing list, but I didn't understand the explanations. I ran this code on Ubuntu 10.04 with Python 2.6.5. Why do the functions g and behave differently? If calls (3) and g(3) both exit their functions in the same state, why do they not enter in the s

Re: how do I search python mailing list archives?

2010-10-21 Thread Sean Choi
just sending out a late thank you for the response -- http://mail.python.org/mailman/listinfo/python-list

question regarding thread display on python mailing list

2010-10-21 Thread Sean Choi
I notice sometimes when I follow a thread on the mailing list archives, the thread will not be all together. To see what I mean, look at the thread "splitting comp.lang.python" as shown here: http://mail.python.org/pipermail/python-list/2000-March/thread.html#639685. You can see one large chunk of

ftplib - Did the whole file get sent?

2010-10-22 Thread Sean DiZazzo
; + destfile, open(f.path, 'rb')) # log this as success except: # log this as an error Is ftplib reliable enough to say that if an exception is not thrown, that the file was transferred in full? Python 2.4.3 (#1, Sep 17 2008, 16:07:08) Red Hat Enterprise Linux Server release 5.3 (Ti

Re: ftplib - Did the whole file get sent?

2010-10-23 Thread Sean DiZazzo
On Oct 22, 10:48 pm, Steven D'Aprano wrote: > On Fri, 22 Oct 2010 22:03:38 -0700, Sean DiZazzo wrote: > > How can I assure him (and the client) that the transfer completed > > successfully like my log shows? > > "It has worked well for many years, there are no

Bug or intended behavior?

2017-06-02 Thread sean . dizazzo
Can someone please explain this to me? Thanks in advance! ~Sean Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information.

Re: Bug or intended behavior?

2017-06-03 Thread Sean DiZazzo
On Friday, June 2, 2017 at 10:46:03 AM UTC-7, bob gailer wrote: > On 6/2/2017 1:28 PM, Jussi Piitulainen wrote: > > sean.diza...@gmail.com writes: > > > >> Can someone please explain this to me? Thanks in advance! > >> > >> ~Sean > >> > >&g

traceback.format_exc() returns 'None\n'?!

2017-08-31 Thread Sean DiZazzo
c() >>> type(tb) >>> tb 'None\n' >>> Shouldn't it just return None itself? Why a string with a newline? Interested if there is an actual reason for this behavior or if it should be reported as a bug. ~Sean -- https://mail.python.org/mailman/listinfo/python-list

Python - CGI-BIN - Apache Timeout Problem

2012-03-02 Thread Sean Cavanaugh (scavanau)
ut-on-fre ebsd-apache22 Thanks in advance for any ideas. I can include the whole main.py if that would help. Sean Cavanaugh Cisco Systems -- http://mail.python.org/mailman/listinfo/python-list

RE: Python - CGI-BIN - Apache Timeout Problem

2012-03-02 Thread Sean Cavanaugh (scavanau)
l Message- From: ch...@rebertia.com [mailto:ch...@rebertia.com] On Behalf Of Chris Rebert Sent: Friday, March 02, 2012 3:23 PM To: Sean Cavanaugh (scavanau) Cc: python-list@python.org Subject: Re: Python - CGI-BIN - Apache Timeout Problem On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scavanau) wrote: &g

RE: Python - CGI-BIN - Apache Timeout Problem

2012-03-02 Thread Sean Cavanaugh (scavanau)
-- From: ch...@rebertia.com [mailto:ch...@rebertia.com] On Behalf Of Chris Rebert Sent: Friday, March 02, 2012 3:23 PM To: Sean Cavanaugh (scavanau) Cc: python-list@python.org Subject: Re: Python - CGI-BIN - Apache Timeout Problem On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scavanau) wrote: > THE PRO

RE: Python - CGI-BIN - Apache Timeout Problem

2012-03-04 Thread Sean Cavanaugh (scavanau)
Original Message- From: ch...@rebertia.com [mailto:ch...@rebertia.com] On Behalf Of Chris Rebert Sent: Friday, March 02, 2012 3:23 PM To: Sean Cavanaugh (scavanau) Cc: python-list@python.org Subject: Re: Python - CGI-BIN - Apache Timeout Problem On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scav

<    1   2   3   4   5   >