command prompt: the ntvdm cpu has encountered an illegal instruction

2009-05-24 Thread Daniel
If I try to invoke python via the command prompt I get an error "command prompt: the ntvdm cpu has encountered an illegal instruction..." I don't get this problem if I first cd to the python directory. I am running python 3.0 on windows. -- http://mail.python.org/mailman/listinfo/python-list

Re: command prompt: the ntvdm cpu has encountered an illegal instruction

2009-05-24 Thread Daniel
On 24 May, 18:32, Gerhard Häring wrote: > > Running Python from the Cygwin shell? Try from outside Cygwin, then. > No I am running from the windows command prompt. -- http://mail.python.org/mailman/listinfo/python-list

how to change response code in CGIHTTPServer.py

2009-05-28 Thread Daniel
Hello, Python 2.5.2 WinXP I'm using CGIHTTPServer.py and want to return a response code of 400 with a message in the event that the cgi script fails for some reason. I notice that run_cgi(self): executes this line of code, self.send_response(200, "Script output follows") which overwrites any hea

Parsing tuple from string?

2008-04-23 Thread Daniel
eed to be able to capture n-tuples. Can someone help point me to the correct re or a better way to solve this? Thanks in advance, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing tuple from string?

2008-04-23 Thread Daniel
On Apr 23, 4:22 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Apr 23, 6:24 pm, Daniel <[EMAIL PROTECTED]> wrote: > > > I have a list of strings, which I need to convert into tuples. If the > > string is not in python tuple format (i.e. "('one', &#x

How to simulate packages?

2008-08-21 Thread Daniel
ports sys.path.append('\\'.join(os.path.dirname(__file__).split('\\') [:len(os.path.dirname(__file__).split('\\'))-1]) + "\\" + dir) Any and all suggestions appreciated. Thanks in advance. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: How to simulate packages?

2008-08-21 Thread Daniel
On Aug 21, 12:26 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 21 Aug 2008 13:04:51 -0300, Daniel <[EMAIL PROTECTED]>   > escribi : > > > I have a project that I've decided to split into packages in order to > > organize my code b

Re: How to simulate packages?

2008-08-21 Thread Daniel
On Aug 21, 2:22 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Daniel a écrit : > > > Hello, > > > I have a project that I've decided to split into packages in order to > > organize my code better.  So what I have looks something like this > >

Enhanced property decorator

2008-08-25 Thread Daniel
ty descriptor prevents built-in clutter. (2) encapsulation of property logic inside function namespace, preventing clutter in class namespace. (3) doc string appears in a more natural place, before getter/setter/ delter logic, as in classes and functions. Cons: difficult to implement? Of course, mo

Re: Enhanced property decorator

2008-08-25 Thread Daniel
gt;     @my_prop.deleter >     def my_prop(): del self._prop Hmm, interesting. I wonder if it suppports setting the doc-string in a similar way? I'll have to look into that. Thanks for pointing this out. ~ Daniel -- http://mail.python.org/mailman/listinfo/python-list

Python and database unittests

2008-08-26 Thread Daniel
ml I have found http://qualitylabs.org/pdbseed/, which helps with unittests for a live database. This isn't what I'm after. Does anyone know about a module that acts as a database stub for python unittests? Thanks, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and database unittests

2008-08-26 Thread Daniel
t with the MySQL database is different than the sqlite portion. Thanks again, Daniel On Aug 26, 4:12 pm, gordyt <[EMAIL PROTECTED]> wrote: > Daniel I don't know if it would work for your situation or not, but if > you are using Python 2.5, you could use the now built-in sqlit

problem with packages and path

2008-08-27 Thread Daniel
he path (and it does). import os, sys newpath = os.path.normpath( os.path.join( __file__, "../../" )) sys.path.append(newpath) I still get the same error. Can someone please point me in the right direction? Thanks in advance: Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with packages and path

2008-08-27 Thread Daniel
On Aug 27, 11:00 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 27 Aug, 18:44, Daniel <[EMAIL PROTECTED]> wrote: > > > > > I'm writing some unit tests for my python software which uses > > packages.  Here is the basic structure: > > > mypacka

Re: problem with packages and path

2008-08-27 Thread Daniel
On Aug 27, 11:00 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 27 Aug, 18:44, Daniel <[EMAIL PROTECTED]> wrote: > > > > > I'm writing some unit tests for my python software which uses > > packages.  Here is the basic structure: > > > mypacka

Re: problem with packages and path

2008-08-29 Thread Daniel
On Aug 28, 2:28 am, "Marco Bizzarri" <[EMAIL PROTECTED]> wrote: > On Wed, Aug 27, 2008 at 6:44 PM, Daniel <[EMAIL PROTECTED]> wrote: > > Hello, > > > I'm writing some unit tests for my python software which uses > > packages.  Here is th

Re: When to use try and except?

2008-08-29 Thread Daniel
On Aug 29, 11:23 am, cnb <[EMAIL PROTECTED]> wrote: > If I get zero division error it is obv a poor solution to do try and > except since it can be solved with an if-clause. > > However if a program runs out of memory I should just let it crash > right? Because if not then I'd have to write excepti

Re: problem with packages and path

2008-08-29 Thread Daniel
On Aug 29, 1:15 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 29 Aug, 19:08, Daniel <[EMAIL PROTECTED]> wrote: > > > > > > > I have tried running both commands above from the mypackage directory > > and unittests directory.  I get the following res

problem with "ImportError: No module named..." and sockets

2008-09-30 Thread Daniel
Hello, I'm trying to build a very simple IPC system. What I have done is create Data Transfer Objects (DTO) for each item I'd like to send across the wire. I am serializing these using cPickle. I've also tried using pickle (instead of cPickle), but I get the same response. Below is the code.

Re: problem with "ImportError: No module named..." and sockets

2008-09-30 Thread Daniel
On Sep 30, 4:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <[EMAIL PROTECTED]>   > escribió: > > > > > [BEGIN CODE] > > #!/usr/bin/python > > import SocketServer > > import o

Re: problem with "ImportError: No module named..." and sockets

2008-10-01 Thread Daniel
On Sep 30, 5:49 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 30 Sep 2008 19:44:51 -0300, Daniel <[EMAIL PROTECTED]>   > escribió: > > > > > On Sep 30, 4:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > > wrote:

problem with sockets code

2008-10-02 Thread Daniel
Hello, I can't seem to get my sockets code to work right. Here is what I have inside my RequestHandler handle() function: total_data=[] data = True logger_server.debug(self.__class__.__name__ + ' set data = True') while data: logger_server.debug(self.

Re: windows help files ?

2008-10-02 Thread Daniel
wser (no internet connection required)? That would enable you to use the same mechanism on all platforms. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Sample code required to validate a xml file against XSD

2008-10-02 Thread Daniel
g/pipermail/xml-sig/2003-March/009244.html hope it helps. Daniel -- http://mail.python.org/mailman/listinfo/python-list

How to send Data Transfer Objects across the network?

2008-10-02 Thread Daniel
mplete the transaction. Thanks in advance... Daniel -- http://mail.python.org/mailman/listinfo/python-list

Immediate Help with python program!

2009-12-09 Thread Daniel
i am making a tic-tac-toe game using python. i am pretty new to it, but cant seem to figure this one out. Here is my code: X = "X" O = "O" empty = " " tie = "Tie" squares = 9 def display(): print """Welcome to Tic-Tac-Toe. Player will play against the computer. \nYou will move by

Re: Immediate Help with python program!

2009-12-09 Thread Daniel
On Dec 9, 6:18 pm, Jon Clements wrote: > On Dec 9, 11:55 pm, Daniel wrote: > > > > > i am making a tic-tac-toe game using python. i am pretty new to it, > > but cant seem to figure this one out. > > Here is my code: > > > X = "X" > >

Re: Immediate Help with python program!

2009-12-09 Thread Daniel
On Dec 9, 6:50 pm, MRAB wrote: > Daniel wrote: > > i am making a tic-tac-toe game using python. i am pretty new to it, > > but cant seem to figure this one out. > > Here is my code: > > [snip] > You problem is due to your choice of variable names, because '0&

Authenticated encryption with PyCrypto

2010-01-25 Thread Daniel
ake? Also, slightly related, is there an easy way to get the sha/md5 deprecation warnings emitted by PyCrypto in Python 2.6 to go away? ~ Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Authenticated encryption with PyCrypto

2010-01-26 Thread Daniel
ce them via the warnings module. I suppose that the > latest version of PyCrypto fixes these warnings. The version that gets installed by easy_install or pip (2.0.1) emits those warnings. Is there a more recent version? Thanks for the feedback. ~ Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Authenticated encryption with PyCrypto

2010-01-26 Thread Daniel
is of its key schedule. Changed easily enough. The updated recipe defaults to AES-192. I also made one other minor tweak: the global constants were moved to class-level so they can be overridden more easily if needed. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Authenticated encryption with PyCrypto

2010-01-26 Thread Daniel
M.-A. Lemburg wrote: > Daniel wrote: > > On Jan 26, 12:37 pm, "M.-A. Lemburg" wrote: > >> Note that your code has a padding bug: the decoder doesn't > >> undo the padding. You're lucky though, since pickle will only > >> read as much data a

403 error for python webpage

2009-06-07 Thread Daniel
I created a page with a ".py" extension but the browser does not like it. Here is what I did: I edited httpd.conf file and added the line: AddHandler cgi-script .cgi .py Then I stopped and restarted apache. Next I created a hello world file as on this page: http://deron.meranda.us/python/webserving

Limit (max) connections SimpleHTTPServer

2009-06-15 Thread Daniel
Hello, I would like to know if there is some way to limit the maximum number of connections to my SimpleHTTPServer. I have built a system that sends out work from one box to worker boxes and am using SimpleHTTPServer to send the work. The files are very large (sometimes as much as 20-30MB). Whe

find free hard disk space remote windows host

2009-08-31 Thread Daniel
Hello, I'm trying to determine the amount of free hard disk space on a remote windows host. Seems like this should be simple, but it's giving me grief. Here's what I've tried: >>> mystat = os.stat('//remotehost/share/') >>> mystat (16895, 0L, 0, 0, 0, 0, 0L, 1251731920, 1251731289, 1249399952)

set breakpoint in another module/file

2009-09-22 Thread Daniel
s\n" % error) return sys.__stdout__.write("\n") pdb.do_break("") # print breakpoints sys.settrace(pdb.trace_dispatch) I'm sure there is a better way to implement some of this, especially the part marked with HACK, but it seems to work for me in most situations. ~ Daniel -- http://mail.python.org/mailman/listinfo/python-list

extracting variables accessed and written from function / rule-based function calls

2010-11-01 Thread Daniel
Hello, I have a class with some members that depend on others. Initially most of them are None. For each one there is a function to calculate it as soon as some other dependencies become available. In the end, all values can be computed by the right sequence of function applications. class A:

Re: extracting variables accessed and written from function / rule-based function calls

2010-11-02 Thread Daniel
> >> You might be interested by the story of how AstraZeneca tackled that > >> kind of problem in PyDrone:http://www.python.org/about/success/astra/ that is interesting! So it seems they store the values in a dictionary. For each value they associate a function that gets called when the value is n

I want to know how to implement concurrent threads in Python

2013-05-26 Thread Daniel Gagliardi
I want to know how to implement concurrent threads in Python -- http://mail.python.org/mailman/listinfo/python-list

Re: I want to know how to implement concurrent threads in Python

2013-05-27 Thread Daniel Gagliardi
fuck! fuck! i'm gonna be fired if i didnt get this shit! i told my boss id do it. fuck! im gonna pipe some crakc. fuck... 2013/5/26 Mark Lawrence > On 26/05/2013 20:10, Daniel Gagliardi wrote: > >> I want to know how to implement concurrent threads in Python >> >&g

Help with pygame

2013-07-16 Thread Daniel Kersgaard
I'm having a little trouble, tried Googling it, but to no avail. Currently, I'm working on making a snake game, however I'm stuck on a simple border. The only thing I need help with is when you run the program, the bottom right corner of the border is missing. I'm not sure why. And I know I'm no

Re: Help with pygame

2013-07-16 Thread Daniel Kersgaard
I didn't even think about that! I added one more draw and it worked like a charm, thanks so much! I'm not sure why I couldn't think of that! -- http://mail.python.org/mailman/listinfo/python-list

lambda in list comprehension acting funny

2012-07-10 Thread Daniel Fetchinson
funcs = [ lambda x: x**i for i in range( 5 ) ] print funcs[0]( 2 ) print funcs[1]( 2 ) print funcs[2]( 2 ) This gives me 16 16 16 When I was excepting 1 2 4 Does anyone know why? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org

Re: lambda in list comprehension acting funny

2012-07-10 Thread Daniel Fetchinson
> funcs = [ lambda x: x**i for i in range( 5 ) ] > print funcs[0]( 2 ) > print funcs[1]( 2 ) > print funcs[2]( 2 ) > > This gives me > > 16 > 16 > 16 > > When I was excepting > > 1 > 2 > 4 > > Does anyone know why? And more importantly, what's the simplest way to achieve the latter? :) -- Psss,

Re: lambda in list comprehension acting funny

2012-07-11 Thread Daniel Fetchinson
t; >Try giving the lambda a default parameter (they get calculated and > have their value stored at the time the lambda is defined) like this: >funcs = [ lambda x, i=i: x**i for i in range( 5 ) ] Thanks a lot! I worked around it by def p(i): return lambda x: x**i funcs = [ p(i) fo

Re: lambda in list comprehension acting funny

2012-07-11 Thread Daniel Fetchinson
turn x**i > > i = 3 > def f3(x): return x**i > > Is there any surprise that all three functions return the same value? > They all point to the same global variable i. I'm not sure what it is > about lambda that fools people into thinking that it is different (I've > even been fooled myself!) but it is not. Thank you Steve! Precise and clear, as always! Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: Demise of Mr. Kenneth Gonsalves

2012-08-03 Thread Daniel Roseman
and to the Django community in general. Please pass on condolences to his family and friends. -- Daniel. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does python have built command for package skeleton creation?

2012-09-24 Thread Daniel Nogues
alternatively you can use virtualenv to create virtual environments http://www.virtualenv.org/en/latest/index.html however, if what you want is automated generation of some of the code, you can adopt an IDE or create some macros in your text editor of choice. From: alex23 Date: 24 Septem

terminate called after throwing an instance of 'CABRTException'

2012-10-02 Thread Daniel Fetchinson
e is that I have all sorts of recent files in /var/cache/abrt/pyhook-* indicating that somehow abrt is doing things even though it is not running, for instance chkconfig --list | grep abrt shows it off in all run levels. What's going on? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: terminate called after throwing an instance of 'CABRTException'

2012-10-02 Thread Daniel Fetchinson
t;>>> [name for name in sys.modules if "abrt" in name.lower()] > [] > > gives a non-empty result I'd investigate where the culprit is imported -- > /usr/lib/python2.6/sitecustomize.py would be the obvious candidate. Indeed! Thanks a lot, /usr/lib/python2.6/si

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: 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

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

system tray or notification area in python

2012-10-16 Thread Daniel Fetchinson
Where would I start something like this? Any pointers would be greatly appreciated! Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Fwd: system tray or notification area in python

2012-10-16 Thread Daniel Fetchinson
rk immediately with gtk from C. But I have zero experience with gui programming in python. So any pointers would be much appreciated how to implement a system tray in python. Gtk is I guess just one option, one could use other stuff from python but I wouldn't know what the simplest approach is.

Re: Fwd: system tray or notification area in python

2012-10-17 Thread Daniel Fetchinson
when you write that you have no experience with > GUI programming, I'd start another projet first - I think you will have > a tough way to succeed with this project. I certainly wouldn't start with Xlib in C, but if python bindings would be available that would make life much easier. Cheers, Daniel > Christian > -- > http://mail.python.org/mailman/listinfo/python-list > -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: system tray or notification area in python

2012-10-17 Thread Daniel Fetchinson
programming, I'd start another projet first - I think you will have >>> a tough way to succeed with this project. >> >> I certainly wouldn't start with Xlib in C, but if python bindings >> would be available that would make life much easier. >> >

Re: len() on mutables vs. immutables

2012-10-18 Thread Daniel Urban
On Thu, Oct 18, 2012 at 8:42 PM, Demian Brecht wrote: >> str, bytes, bytearrays, arrays, sets, frozensets, dicts, dictviews, and >> ranges should all return len in O(1) time. That includes the possibility >> of a subtraction as indicated above. > > Awesome. Pretty much what I figured. Of course, I

Re: get each pair from a string.

2012-10-22 Thread Daniel Nogues
Hello rusi This is a little bit faster: s = "apple" [s[i:i+2] for i in range(len(s)-1)] >>> timeit("""s = "apple" ... [a+b for a,b in zip(s, s[1:])]""",number=1) 0.061038970947265625 >>> timeit("""s = "apple" ... [s[i:i+2] for i in range(len(s)-1)]""",number=1) 0.0467379093170166 Reg

Re: can we append a list with another list in Python ?

2012-10-23 Thread Daniel Fetchinson
> can we append a list with another list in Python ? using the normal routine > syntax but with a for loop ?? x = [1,2,3] y = [10,20,30] x.extend( y ) print x this will give you [1,2,3,10,20,30] which I guess is what you want. Cheers, Daniel -- Psss, psss, put it down!

Re: Making `logging.basicConfig` log to *both* `sys.stderr` and `sys.stdout`?

2012-10-23 Thread Daniel Dehennin
#x27; : 'logging.StreamHandler', 'stream' : 'ext://sys.stderr', 'level' : 'WARNING', 'formatter' : 'stderr', } }, 'root' : { 'level' : options.log_level.upper(), 'handlers' : ['stdout', 'stderr'], }, } logging.config.dictConfig( config ) return logging.getLogger() #+end_src Regards. -- Daniel Dehennin EOLE pgpP128hCWd2L.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

[SOLVED] Re: Making `logging.basicConfig` log to *both* `sys.stderr` and `sys.stdout`?

2012-10-24 Thread Daniel Dehennin
Daniel Dehennin writes: > Hello, Hi [...] > I tried to setup the same for my scripts with > "logging.config.dictConfig()" without much success, I want to limit > output to stdout to INFO, everything bellow INFO should be sent to > stderr instead. > > Any hints?

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

[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

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.

assign only first few items of a tuple/list

2012-12-04 Thread Daniel Fetchinson
mmon idiom for this that does? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Help "joining" two files delimited with pipe character ("|")

2012-12-05 Thread Daniel Doo
Hello, I am new to Python. Is there a method to "join" two pipe delimited files using a unique key that appears in both files? I would like to implement something similar to the Unix join command. Thanks for your help! Topeka Capital Markets Disclaimers - ht

Help with unittest2

2012-12-13 Thread Daniel Laird
All, I am new to python and am stuck with python 2.6 (Ubuntu 10.04 and dont want to force switch to 2.7) I want to use assertListEqual and other new test functions. However I do am import unittest2 as unittest The code does not fail but any use of the new functions results in: NameError: global n

Re: Help with unittest2

2012-12-13 Thread Daniel Laird
On Thursday, December 13, 2012 3:09:58 PM UTC, Miki Tebeka wrote: > On Thursday, December 13, 2012 7:03:27 AM UTC-8, Daniel Laird wrote: > > > I do am import unittest2 as unittest > > > NameError: global name 'assertListEqual' is not defined > > According t

unpacking first few items of iterable

2012-12-13 Thread Daniel Fetchinson
terested in the first 3 items? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: unpacking first few items of iterable

2012-12-13 Thread Daniel Fetchinson
>>Hi folks, I swear I used to know this but can't find it anywhere: >> >>What's the standard idiom for unpacking the first few items of an >>iterable whose total length is unknown? >> >>Something like >> >>a, b, c, _ = myiterable >> >>where _ could eat up a variable number of items, in case I'm onl

Re: unpacking first few items of iterable

2012-12-13 Thread Daniel Fetchinson
>> a, b, c, *rest = myiterable >> Thanks, sounds great, how about python2? >> > > If you know the sequence has at least n items, you > can do a, b, c = seq[:3] Yeah, that's probably the simplest, without all the fancy stuff :) Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

pygnomevfs get_local_path_from_uri replacement

2012-12-22 Thread Daniel Fetchinson
ave simply lifted it. Does anyone know what a good replacement for get_local_path_from_uri is? Is there a gtk/gnome/etc related python package that contains it which would work with gnome 3? Or a totally gnome-independent python implementation? Cheers, Daniel -- Psss, psss, put it down! - http

Re: pygnomevfs get_local_path_from_uri replacement

2012-12-22 Thread Daniel Fetchinson
uri( uri ): return uri.split( '//' )[1] and it seems to work. In the program the function is always called in a try: except: block so if anything is not okay it will get caught, I don't have to catch exceptions inside the function. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Daniel Fetchinson
rlier! Indeed.. BTW, I also use vim only, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

format a measurement result and its error in "scientific" way

2012-02-15 Thread Daniel Fetchinson
value correspondingly. I've been searching around for a simple function that would take 2 float arguments and would return a string but didn't find anything although something tells me it's been done a gazillion times. What would be the simplest such function? Cheers, Daniel -- Pss

Re: format a measurement result and its error in "scientific" way

2012-02-16 Thread Daniel Fetchinson
le).to_integral() > if 'E' in value_str: > index = value_str.index('E') > return value_str[:index] + error_str + value_str[index:] > else: > return value_str + error_str > >>>> format_error(1.03789291, 0.00089) > &

Re: format a measurement result and its error in "scientific" way

2012-02-16 Thread Daniel Fetchinson
On 2/16/12, Ian Kelly wrote: > On Thu, Feb 16, 2012 at 1:36 AM, Daniel Fetchinson > wrote: >>>> Hi folks, often times in science one expresses a value (say >>>> 1.03789291) and its error (say 0.00089) in a short way by parentheses >>>> like so: 1.0379(9

Re: format a measurement result and its error in "scientific" way

2012-02-17 Thread Daniel Fetchinson
guess, it's failing because scaleb() (which was new in > 2.6) is buggily expecting a decimal argument, but adjusted() returns an int. > Convert the results of the two adjusted() calls to decimals, and I > think it should be fine. Great, with python 2.7 it works indeed! Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: format a measurement result and its error in "scientific" way

2012-02-17 Thread Daniel Fetchinson
of digits for the value that makes sense for the given error. So what you call "non sense" is part of the problem to be solved. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

[ANN] markup.py 1.8

2012-02-18 Thread Daniel Nogradi
A new release of markup.py is available at http://markup.sourceforge.net/ This new release is compatible with both python 2 and 3. What is markup.py? Markup.py is an intuitive, light weight, easy-to-use, customizable and pythonic HTML/XML generator. The only goal is quickly writing HTML/XML segm

Re: Odd strip behavior

2012-03-22 Thread Daniel Steinberg
strip() removes leading and trailing characters, which is why the 't' in the middle of the string was not removed. To remove the 't' in the middle, str1.replace('t','') is one option. On 3/22/12 3:48 PM, Rodrick Brown wrote: #!/usr/bin/python def main(): str1='this is a test' str2=

Re: Fetching data from a HTML file

2012-03-23 Thread Daniel Fetchinson
On 3/23/12, Sangeet wrote: > Hi, > > I've got to fetch data from the snippet below and have been trying to match > the digits in this to specifically to specific groups. But I can't seem to > figure how to go about stripping the tags! :( > > Sum class="green">24511 align='center'>02561.496 > [min]

Re: Open Source: you're doing it wrong - the Pyjamas hijack

2012-05-09 Thread Daniel Fetchinson
It's also quite ironic that the initial complaining started from how the domain name www.pyjs.org is not available only pyjs.org is. At the same time the Rebel Chief's listed domain name on github, see https://github.com/xtfxme, gives you a server not found: http://the.xtfx.me/ :) On 5/9/12, ant

Re: Open Source: you're doing it wrong - the Pyjamas hijack

2012-05-09 Thread Daniel Fetchinson
nity, new infrastructure, new fame, etc, and I sure as hell like to take the easy road as opposed to the hard road". Until you clearly explain your reasoning for taking over as opposed to forking, the default answer is the above one. Cheers, Daniel -- Psss, psss, put it down! - http

Good data structure for finding date intervals including a given date

2012-05-12 Thread Jean-Daniel
Hello, I have a long list of n date intervals that gets added or suppressed intervals regularly. I am looking for a fast way to find the intervals containing a given date, without having to check all intervals (less than O(n)). Do you know the best way to do this in Python with the stdlib? A var

Re: Good data structure for finding date intervals including a given date

2012-05-12 Thread Jean-Daniel
it fast is to have done some preprocessing at insertion time, so that not all intervals are processed at query time. On Sat, May 12, 2012 at 2:30 PM, Karl Knechtel wrote: > On Sat, May 12, 2012 at 8:17 AM, Jean-Daniel > wrote: >> I am looking for a fast way to find the intervals &

Re: Open Source: you're doing it wrong - the Pyjamas hijack

2012-05-15 Thread Daniel Fetchinson
ecision, you do not have to like that decision, you do not have to | > | accept that decision.| > Again, if you don't like the lead developer just fork the project, come up with a new name, new website

Re: Good data structure for finding date intervals including a given date

2012-05-16 Thread Jean-Daniel
/3.1/ > [2] http://www.python.org/getit/releases/2.7.3/ > [3] http://dl.acm.org/citation.cfm?id=645413.652131 > > On Sat, May 12, 2012 at 10:17 PM, Jean-Daniel > wrote: >> >> Hello, >> >> I have a long list of n date intervals that gets added or suppressed &

Re: Good data structure for finding date intervals including a given date

2012-05-21 Thread Daniel Stutzbach
On Wed, May 16, 2012 at 5:38 AM, Jean-Daniel wrote: > On Sun, May 13, 2012 at 2:29 PM, Alec Taylor > wrote: > > There is an ordered dict type since Python 3.1[1] and Python 2.7.3[2]. > > Ordered dict are useful, but they only remember the ordered in which > they were add

Re: Namespace hack

2012-05-24 Thread Daniel Fetchinson
name__] = staticmethod(obj) > else: > raise TypeError('bad export') > Namespace = type(func.__name__, (), ns) > return Namespace() > > > Have fun! Funny, you got to the last line of "import this" but apparently skipped the second line: Explicit is better than implicit. And you didn't even post your message on April 1 so no, I can't laugh even though I'd like to. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: Namespace hack

2012-06-05 Thread Daniel Fetchinson
like to. > > Can you be less condescending? Of course! :) Anyway, the point I was trying to make is that Steve's example is kinda cool but only as a funny exercise and not something for real life. Let's toy with python kinda thing, which is always welcome but with a big fat aster

Re: About a list comprehension to transform an input list

2012-06-08 Thread Daniel Urban
] > > I wonder whether there can be a single list comprehension expression to get > this > result without the aid of the auxiliary function. > > Do you have any comments on this? >>> l = [0,1,2,3,4,5,6,7,8,9] >>> [n if n%2 else 100+n for n in l] [100, 1, 102, 3, 104, 5, 106, 7, 108, 9] Daniel -- http://mail.python.org/mailman/listinfo/python-list

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: Recursion error in metaclass

2011-06-11 Thread Daniel Urban
ink this is the mentioned bug: http://bugs.python.org/issue1294232 Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: integer to binary 0-padded

2011-06-15 Thread Daniel Rentz
Hi, Am 15.06.2011 14:29, schrieb Olivier LEMAIRE: Hi there, I've been looking for 2 days for a way to convert integer to binary number 0-padded, nothing... I need to get numbers converted with a defined number of bits. For example on 8 bits 2 = 0010 bin(2)[2:].zfill(8) Regards D

Re: Run Python script from JS

2011-06-17 Thread Daniel Kluev
est regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: New member intro and question

2011-06-18 Thread Daniel Fetchinson
; (http://www.geek.com/articles/gadgets/dreamplug-puts-a-1-2ghz-arm-pc-in-a-power-outlet-2011022/) > which isn't too shabby but I wonder if it will work. The netbook I use with fedora linux and basically every major python release from 2.4 to 3.2 has more limited resources :) So yes, python wo

Re: Rant on web browsers

2011-06-21 Thread Daniel Kluev
from it. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Bluetooth

2011-06-26 Thread Daniel Kluev
or your own app. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >