Encoding conundrum

2012-11-20 Thread Daniel Klein
With the assistance of this group I am understanding unicode encoding issues much better; especially when handling special characters that are outside of the ASCII range. I've got my application working perfectly now :-) However, I am still confused as to why I can only use one specific encoding.

[Python 3.3/Windows] Path Browser seems to be broken

2012-11-20 Thread Daniel Klein
If you try to expand any of the paths in the Path Browser (by clicking the + sign) then it not only closes the Path Browser but it also closes all other windows that were opened in IDLE, including the IDLE interpreter itself. I did a Google search and it doesn't look like this been reported. If t

Path Browser seems to be broken

2012-11-20 Thread Daniel Klein
If you try to expand any of the paths in the Path Browser (by clicking the + sign) then it not only closes the Path Browser but it also closes all other windows that were opened in IDLE, including the IDLE interpreter itself. A Google search doesn't look like this been reported. If this is truly a

Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Daniel Klein
On Wednesday, October 3, 2012 5:40:12 PM UTC+1, Daniel Klein wrote: > Thank you Steven! That was PRECISELY what I was looking for. (And kwpolska!) -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Daniel Klein
Thank you Steven! That was PRECISELY what I was looking for. -- http://mail.python.org/mailman/listinfo/python-list

Help me abstract this (and stop me from using eval)

2012-10-03 Thread Daniel Klein
Hi! I've got import scripts for a bunch of csv files into an sqlite database. I have one csv file per language. I don't write directly to the sqlite db; this is a django app and I'm creating items in my django models. My script (scripts, unfortunately) work just fine, but it feels beyond stupi

Re: Pytz error: unpack requires a string argument of length 44

2012-06-13 Thread Daniel Klein
The windows box is my development box, it's not where the script will be running in the end. It'll be running on a Linux box where I don't have root so python setup.py install isn't an option (to my understanding). So what happened is that 7zip didn't unzip the .tar.gz2 properly, but it does fi

Re: Named loops for breaking

2010-03-10 Thread Daniel Klein
Thanks for the link to the PEP. I should search through PEPs first next time :) Okay, I understand Guido's reasoning and yield the point. I typed up the specific example in which I came across this problem and, while doing so, realized there's a much better way of approaching the problem, so thank

Named loops for breaking

2010-03-09 Thread Daniel Klein
Hey, I did a little searching and couldn't really find much recent on this. The only thing I found was this: http://groups.google.com/group/comp.lang.python/browse_thread/thread/a696624c92b91181/5b7479fdc3362b83?lnk=gst&q=break+named+loop#5b7479fdc3362b83 Basically I'm wondering if there are any

Upgrading from 2.5 to 2.6

2008-10-12 Thread Daniel Klein
Are there any guidelines for upgrading from 2.5 to 2.6? Do you have to uninstall 2.5, or does the installer do that for you? I have wxPython, mod_python and Django installed. Will these have to reinstalled/reconfigured for 2.6? Platform: Windows XP Pro SP3 Daniel Klein -- http

Re: mod_python and updated files

2008-08-18 Thread Daniel Klein
On Mon, 18 Aug 2008 09:16:13 -0700 (PDT), Aaron Scott <[EMAIL PROTECTED]> wrote: >I have mod_python running on my server, but when I chance a Python >file on the server, Apache needs to be restarted in order to have the >changes take effect. I assume this is so mod_python can run >persistently, bu

Re: How to round a floating point to nearest 10?

2008-08-09 Thread Daniel Klein
On Sat, 9 Aug 2008 04:31:38 -0700 (PDT), Will Rocisky <[EMAIL PROTECTED]> wrote: >I want my 76.1 to be rounded to decimal 80 and 74.9 to decimal 70. >How can I achieve that? >>> for n in (74.9, 76.1): print int((n+5)/10)*10 70 80 Dan -- http://mail.python.org/mailman/listinfo/python-lis

Re: Help need with subprocess communicate

2008-06-05 Thread Daniel Klein
with a similar python script... import sys sys.stdout.write('process started...\n') r = sys.stdin.readline() sys.stdout.write(r + '\n') s = sys.stdin.readline() sys.stdout.write(s + '\n') I called this 'p3.py'. When I plug this into the 'p2.py' script I get nothing, it just hangs. So maybe there is something else I am missing. I normally don't do things this way cos there are os size limits to what you can send/recv, so I use my own protocol (similar to netstrings) for communication. Daniel Klein -- http://mail.python.org/mailman/listinfo/python-list

Re: Help need with subprocess communicate

2008-06-03 Thread Daniel Klein
ternatively, you can use std.write() and stdout.read() (without universal_newlines) but this means you need to create your own IPC protocol (like netstrings). Hope this helps, Daniel Klein -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Magazine: Issue 1 Free!

2007-10-10 Thread Daniel Klein
ed of the availability of new issues automatically, yet I received no such notification. Daniel Klein -- http://mail.python.org/mailman/listinfo/python-list

Re: pipes

2007-09-11 Thread Daniel Klein
provides an easier interface imo, eg: process = subprocess.Popen('tool.exe', stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=true) (self.outstream, self.instream) = (process.stdout, process.stdin) Daniel Klein -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about raise and exceptions.

2007-02-28 Thread Daniel Klein
On Wed, 28 Feb 2007 22:03:13 +0100, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Daniel Klein a écrit : >> The arguments for TransitionError must be a tuple, > >Err... > >> eg: >> >> msg = "Going to error state %d from state %d" % (self.cu

Re: Question about raise and exceptions.

2007-02-28 Thread Daniel Klein
On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr" <[EMAIL PROTECTED]> wrote: >When I run it I get this: > >884 > ./t_fsm.py >Traceback (most recent call last): > File "./t_fsm.py", line 3, in ? > from fsm import * > File "/home/boston/VIASAT/sorr/py/fsm/fsm.py", line 76 > raise

Re: Getting a class name

2007-02-18 Thread Daniel Klein
On 18 Feb 2007 04:24:47 -0800, "Fuzzyman" <[EMAIL PROTECTED]> wrote: >On Feb 17, 8:33 pm, deelan <[EMAIL PROTECTED]> wrote: >> Harlin Seritt wrote: >> > Hi, >> >> > How does one get the name of a class from within the class code? I >> > tried something like this as a guess: >> >> > self.__name__ >

Problem saving changes in MoinMoin pages

2007-02-01 Thread Daniel Klein
[I'm having some difficulty contacting 'real' MoinMoin support channels so I am posting this question here. Hope that's ok.] I have a pressing need to get a wiki up and running in a fairly short timeframe. I did some investigations and the Python MoinMoin wiki seemed to be the best choice for me b

MoinMoin

2007-01-30 Thread Daniel Klein
Is it fair game to ask questions about MoinMoin here? If not, can someone recommend a resource please? Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: strip question

2007-01-30 Thread Daniel Klein
On 26 Jan 2007 21:33:47 -0800, [EMAIL PROTECTED] wrote: >hi >can someone explain strip() for these : >[code] x='www.example.com' x.strip('cmowz.') >'example' >[/code] > >when i did this: >[code] x = 'abcd,words.words' x.strip(',.') >'abcd,words.words' >[/code] > >it does not st

Python 2.5 and Zeus

2007-01-24 Thread Daniel Klein
Does anyone know if the Zeus IDE is compatible with Python 2.5? I sent an email to Zeus a couple days ago but have not heard anything. Thanks, Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Match 2 words in a line of file

2007-01-19 Thread Daniel Klein
On 18 Jan 2007 18:54:59 -0800, "Rickard Lindberg" <[EMAIL PROTECTED]> wrote: >I see two potential problems with the non regex solutions. > >1) Consider a line: "foo (bar)". When you split it you will only get >two strings, as split by default only splits the string on white space >characters. Thus

Re: Learning Python book, new edition?

2007-01-11 Thread Daniel Klein
On Thu, 11 Jan 2007 18:11:06 +0100, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: >Demel, Jeff wrote: > >> Does anyone know if there's a plan in the works for a new edition >> of Learning Python? The current edition (2nd) is a few years old >> and looks like it only covers Python 2.3. > >IIRC, d

__init__ vs __new__

2007-01-11 Thread Daniel Klein
#return list.__new__(cls, alist) I don't really notice any behavioral difference. Is there in fact any difference in using one over the other? Performance? Side effects? ??? I am using Python version 2.5. Thanks, Daniel Klein -- http://mail.python.org/mailman/listinfo/python-list

Re: newbieee

2007-01-08 Thread Daniel Klein
On 8 Jan 2007 10:59:23 -0800, "Thomas Nelson" <[EMAIL PROTECTED]> wrote: >O'reilly has a book called Programming Python that covers much of the >standard library and how to use it for complex tasks. It may be out of >date by now, though. Programming Python (by Mark Lutz) is now in it's 3rd edi

Re: How do I add users using Python scripts on a Linux machine

2007-01-01 Thread Daniel Klein
On 1 Jan 2007 11:33:42 -0800, "Ramdas" <[EMAIL PROTECTED]> wrote: >How do I add users using Python scripts on a Linux machine? > >Someone has a script? This should be as easy as something like: os.system("/usr/sbin/useradd -m -d /home/newuser -s /bin/ksh") Dan -- http://mail.python.org/mailman

Re: Some basic newbie questions...

2006-12-29 Thread Daniel Klein
On 28 Dec 2006 08:40:02 -0800, "jonathan.beckett" <[EMAIL PROTECTED]> wrote: >Hi all, > >Question 2... >What is the correct way of looping through a list object in a class via >a method of it? Without peeking at any of the other responses, here is what I came up with. I hope it helps... class G

Re: popen on windows

2006-12-29 Thread Daniel Klein
On 27 Dec 2006 09:16:53 -0800, "hubritic" <[EMAIL PROTECTED]> wrote: >I am trying to set off commands on Windows 2003 from python. >Specifically, I am trying to use diskpart with a script file (pointed >to with path). > >cmd = ["diskpart", "/s", path] >p = Popen(cmd, shell

Re: skip last line in loops

2006-12-15 Thread Daniel Klein
On 14 Dec 2006 22:47:23 -0800, [EMAIL PROTECTED] wrote: >hi, >how can i skip printing the last line using loops (for /while) > >eg > >for line in open("file): > print line. > >I want to skip printing last line of the file.thanks while True: line1 = myfile.readline() if not line1: brea

Re: How to detect what type a variable is?

2006-11-29 Thread Daniel Klein
tList) == "": > >and >if type(artistList) == "list": > >but nothing.. Try it this way... >>> artistList = [] >>> isinstance(artistList, list) True >>> if isinstance(artistList, list): print "I'm a list." I'm a list. >>> Daniel Klein -- http://mail.python.org/mailman/listinfo/python-list

Re: Having trouble converting popen2 to subprocess

2006-11-18 Thread Daniel Klein
Thanks /F, that was it. Dan On Sat, 18 Nov 2006 15:03:30 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: [snip] >p.stdin is the *other* process' stdin. if you want to read things it >prints, read from p.stdout instead. > >> print fin.readline() >> fin.close() > > -- http://mail.python.org/m

Having trouble converting popen2 to subprocess

2006-11-18 Thread Daniel Klein
size=-1, stdin=PIPE, stdout=PIPE, universal_newlines=True) fin = p.stdin print fin.readline() fin.close() When this is run, I get no output : C:\>python c:\python\sp.py C:\> As you can see, I get no exception. I've tried various combinations of the Popen arguments with no joy. The platform

Will subprocess eventually deprecate popen2 ?

2006-11-16 Thread Daniel Klein
I have a few Python programs that use popen2, and they work quite nicely and dependably, so I don't really have any reason to change them to use the new subprocess module...unless of course there any future plans to deprecate popen2. Is this something I will have to plan for ? -- http://mail.pyth