Re: splitting by double newline

2011-02-07 Thread Nikola Skoric
Dana Mon, 7 Feb 2011 10:02:05 -0800 (PST), Ian kaze: > self.tables = re.split(r'(?:\r\n){2,}|\r{2,}|\n{2,}', bulk) Thanks! I tried without "?:", but it didn't work. Can you tell me why is it important that group is noncapturing? -- "Now the storm has passed over me I'm left to drift on a dea

Re: splitting by double newline

2011-02-07 Thread Nikola Skoric
Dana Mon, 07 Feb 2011 19:20:38 +0100, Peter Otten <__pete...@web.de> kaze: > with open(filename, "U") as f: Oh, fabulous. Thanks! -- "Now the storm has passed over me I'm left to drift on a dead calm sea And watch her forever through the cracks in the beams Nailed across the doorways of the bed

splitting by double newline

2011-02-07 Thread Nikola Skoric
Hello everybody, I'd like to split a file by double newlines, but portably. Now, splitting by one or more newlines is relatively easy: self.tables = re.split("[\r\n]+", bulk) But, how can I split on double newlines? I tried several approaches, but none worked... -- "Now the storm has passed ov

Re: sending through non-default gateway

2011-02-05 Thread Nikola Skoric
Dana Sat, 5 Feb 2011 14:13:11 -0800, Dan Stromberg kaze: > IIRC, this is an instance of what's called "source routing", and was > largely shut off after network admins realized it was a security > issue. > > Of course, if you have root/administrator permission, you could > probably do it. But if

sending through non-default gateway

2011-02-05 Thread Nikola Skoric
Is there a way to create a TCP connection using a gateway of my choice? I have a regular user account on a WinXP machine. It has a DNS server and default gateway configured, and that DNS server and default gateway don't see the rest of the Internet, just the local network. But, I know an IP addres

Re: downcasting problem

2010-10-25 Thread Nikola Skoric
Dana Mon, 25 Oct 2010 09:38:42 -0500, Tim Chase kaze: > While a dirty hack for which I'd tend to smack anybody who used > it...you *can* assign to instance.__class__ Wow! Python never stops to amaze me. > If it breaks you get to keep all the parts :) Yes, I can see great potential for shit hi

downcasting problem

2010-10-25 Thread Nikola Skoric
Hi everybody, I need to downcast an object, and I've read repeatedly that if you need to downcast, you did something wrong in the design phase. So, instead of asking how do you downcast in python, let me explain my situation. I have a 2-pass parser. 1st pass ends up with a bunch of superclass obj

Re: what difference does redirection make?

2010-10-18 Thread Nikola Skoric
Dana Sun, 17 Oct 2010 15:36:13 -0400, Benjamin Kaplan kaze: > On Sun, Oct 17, 2010 at 3:04 PM, Nikola Skoric wrote: > You're trying to write Unicode to a file. But there's no such thing as /snip > .encode("cp1252") or whatever encoding you wa

what difference does redirection make?

2010-10-17 Thread Nikola Skoric
When I execute n...@rilmir:~/code/simplepyged/docs/examples$ python latex.py I get expected output (bunch of latex markup). But, when I add a redirection, I get: n...@rilmir:~/code/simplepyged/docs/examples$ python latex.py > foo.tex File "latex.py", line 87, in print mytemplate.render_uni

subclass constructor problem

2010-10-05 Thread Nikola Skoric
I have a superclass Element and a subclass Family. All Family.__init__() does is run Element.__init__() and self.__parse(). For some reason it seems like self.__parse() isn't run. Here is the code: http://github.com/dijxtra/simplepyged/blob/8d5a6d59268f6760352783cce6b97c0b5e75b8be/simplepyged/sim

Re: catching my own exception

2010-06-20 Thread Nikola Skoric
Dana Sun, 20 Jun 2010 10:53:08 +0200, Peter Otten <__pete...@web.de> kaze: > Now in your case village.py is first run as the main script and then [...] > In the account module you indirectly raise village.ExceptionWithLongName and > in __main__ you try to catch __main__.ExceptionWithLongName. P

Re: catching my own exception

2010-06-19 Thread Nikola Skoric
Dana 18 Jun 2010 17:45:31 GMT, Steven D'Aprano kaze: > Other than that, I notice that your module throws away useful debugging > information, and replaces it with bland, useless pap of no nutritional > value: > > try: > import account, fetch, resources, const > except Exception: > raise

Re: catching my own exception

2010-06-19 Thread Nikola Skoric
Dana Fri, 18 Jun 2010 20:01:45 +0200, Peter Otten <__pete...@web.de> kaze: > Solution: move your startup code into a separate file and have it import the > village module. Excellent, thanks! Everything works now, but I still don't quite get what the problem is... > You are importing your main

including constants

2009-09-13 Thread Nikola Skoric
Hi there, I have a simple problem and I know how to solve it :-D, but I suspect that there is a standard solution which is more elegant. So, here is my problem: I have django app versioned with svn and I test my trunk on two different machines (one with mysql, another with sqlite3). How do I remo

python web programming for PHP programmers

2008-12-24 Thread Nikola Skoric
I0m a python newbie with PHP background. I've tried to make a web app from one of my python scripts (which I haven't done before) and I ended up with: which works really nice :-D For some reason I can't find no "quick and dirty python web programming tutorial for PHP programmers" on google. :-D

Re: win32serviceutil won't start

2007-11-28 Thread Nikola Skoric
Dana Mon, 26 Nov 2007 08:50:23 -0800 (PST), [EMAIL PROTECTED] <[EMAIL PROTECTED]> kaze: > Sorry I didn't reply sooner. If you're creating a service based on a > Python file, check out the following links in addition to the book > Wolfgang mentioned: > > http://agiletesting.blogspot.com/2005/09/run

Re: win32serviceutil won't start

2007-11-25 Thread Nikola Skoric
Dana Sun, 25 Nov 2007 13:52:35 -0800 (PST), [EMAIL PROTECTED] <[EMAIL PROTECTED]> kaze: > Looks like Microsoft thinks you mis-spelled it. > > http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/w2000Msgs/3310.mspx?mfr=true > > I would check and see if that service is installed on y

win32serviceutil won't start

2007-11-25 Thread Nikola Skoric
I have a very simple win32serviceutil script: import win32serviceutil, time win32serviceutil.StartService("burek", "localhost") time.sleep(10) exit() It successfuly imports win32serviceutil, and chokes on StartService: Traceback (most recent call last): File "foobar.py", line 3, in ? win3

Re: formated local time

2007-11-16 Thread Nikola Skoric
Dana Thu, 15 Nov 2007 10:12:11 -0600, Adam Pletcher <[EMAIL PROTECTED]> kaze: >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On > Behalf >> Of [EMAIL PROTECTED] >> Sent: Thursday, November 15, 2007 9:56 AM >> To: python-list@python.org >> Subject: Re: formate

formated local time

2007-11-15 Thread Nikola Skoric
I have been trying to find appropriate way to do get local time in "-mm-dd hh:mm:ss" format, but the best I got is this: datetime.datetime.fromtimestamp(time.mktime(time.localtime())) It seems to me I'm missing a much simpler method, am I? -- "Now the storm has passed over me I'm left to drif

daemon under windows

2007-11-14 Thread Nikola Skoric
I wrote a simple UNIX daemon (using 2 forks) which does a simple job: it executes a function, waits for some time, and then executes it again. Now I'd like to port that to Windows. How do I create daemon on Windows (since I can't use fork)? -- "Now the storm has passed over me I'm left to drif

http client using ssh -D

2007-11-02 Thread Nikola Skoric
Is there a python library which supports using SOCKS proxy which I create by "ssh -D port remote-host"? I was trying to use that socket by SocksiPy, but I get "channel 3: open failed: administratively prohibited: open failed" on the server side. And I can use that channel freely with firefox. Any o

getting text inside the HTML tag

2007-07-14 Thread Nikola Skoric
I'm using sgmllib.SGMLParser to parse HTML. I have successfuly parsed start tags by implementing start_something method. But, now I have to fetch the string inside the start tag and end tag too. I have been reading through SGMLParser documentation, but just can't figure that out... can somebody hel

cron job times out

2006-11-24 Thread Nikola Skoric
Hello, I have a few lines of code retrieving a web page and saving some variables from it to a log. And everything works nice from command line. but, when I make a cron job, I get an error: Your "cron" job on fly cd $HOME/bin/ ; python newartlog.py ; cd produced the following output: Tracebac

Re: forcing exceptions

2006-03-03 Thread Nikola Skoric
In article <[EMAIL PROTECTED]>, Paul Rubin <http://[EMAIL PROTECTED]> says... > Nikola Skoric <[EMAIL PROTECTED]> writes: > > Is there a way to tell the interpreter to display exceptions, even those > > which were captured with except? > > Normally you wou

forcing exceptions

2006-03-03 Thread Nikola Skoric
Is there a way to tell the interpreter to display exceptions, even those which were captured with except? -- "Now the storm has passed over me I'm left to drift on a dead calm sea And watch her forever through the cracks in the beams Nailed across the doorways of the bedrooms of my dreams" --

making 'utf-8' default codec

2006-02-27 Thread Nikola Skoric
Hi there, Is there a way of making 'utf-8' default codec for the whole program, so I don't have to do .encode('utf-8') every time I print out a string? -- "Now the storm has passed over me I'm left to drift on a dead calm sea And watch her forever through the cracks in the beams Nailed across t