[ANNOUNCE] Thirtieth release of PythonCAD now available

2006-03-22 Thread Art Haas
Hi. I'm pleased to announce the thirtieth development release of PythonCAD, a CAD package for open-source software users. As the name implies, PythonCAD is written entirely in Python. The goal of this project is to create a fully scriptable drafting program that will match and eventually exceed

itools 0.13.0 released

2006-03-22 Thread J. David Ibáñez
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 itools is a Python library, it groups a number of packages into a single meta-package for easier development and deployment: itools.catalogitools.i18n itools.uri itools.cmsitools.ical itools.web

Release: DirectPython 0.2.5

2006-03-22 Thread Heikki Salo
A new version of DirectPython is now available at http://directpython.sourceforge.net/ What is it? --- DirectPython is a C++ extension to the Python programming language which provides access to DirectX (9.0c) API, including Direct3D, DirectSound, DirectShow and DirectInput. The full

Release: vizann-2.0 Tkinter Neural Net Demo Program

2006-03-22 Thread I. Myself
Release Name: vizann-2.0 http://sourceforge.net/project/showfiles.php?group_id=78946 This freeware program may be downloaded from http://sourceforge.net/projects/annevolve. *Notes:* This is a program to graphically demonstrate the operational details of two types of ANN

ANN: IlliPy (Champaign-Urbana's) Python User Group Kickoff Meeting 4/26 @ 7PM

2006-03-22 Thread mbbx6spp
Venue: Giuliani (next to Murphy's Bar) Date: Wednesday April 26, 2006 Time: 7PM URL: http://illipy.tautology.net/events This is the kickoff meeting for the Champaign-Urbana Python User Group (called IlliPy). We will be talking about upcoming Python talks, open source project initiatives and the

Re: doctest, unittest, or if __name__='__main__'

2006-03-22 Thread Max M
[EMAIL PROTECTED] wrote: and you can kill two birds with one stone. By that, do you mean you can write your tests and your docstrings in one shot with doctest? Exactly. '\n'.join(['Doctests are absolutely brilliant!'] * 100) They combine two brilliant ideas that are hard to do in

Re: TypeError coercing to Unicode with field read from XML file

2006-03-22 Thread Fredrik Lundh
Randall Parker wrote: I'm probably doing something dumb as I've never done XML in Python before. Any ideas what? using minidom ? ;-) if you're not wedded to minidom, there are alternatives that are easier to use for things like this. here's an ElementTree version of your code:

Re: markup.py - HTML/XML generator

2006-03-22 Thread Fredrik Lundh
Gerard Flanagan wrote: Now I can do this: page = HtmlPage('Test Page') navbar = page.div(id='left').ul(css='navbar') for href,link in {'/home':'Home', '/shop':'Shop', '/cart':'Cart'}.iteritems(): navbar.li.a(link,href=href) page.div(id='main').h1('Header').p('Text

Re: String comparison question

2006-03-22 Thread Fredrik Lundh
Michael Spencer wrote: a.split() == b.split() is a convenient test, provided you want to normalize whitespace rather than ignore it. I took the OP's requirements to mean that 'A B' == 'AB', but this is just a guess. I'm sure someone has studied this in more detail, but intuitively,

Re: From Python to c++

2006-03-22 Thread Marco Aschwanden
On Wed, 22 Mar 2006 08:11:24 +0100, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is so scary, I probably shouldn't post this. It sounds from your description, you really want RTTI. I haven't done this in a long while, so I'm not sure there is an easier way. But the program below works

How to kill/stop a Thread?

2006-03-22 Thread Dirk Zimmermann
Hi, I like to do the following: Via http I get a stream of data and I like to store this data with a python program. So what I need is to start the downloading and to stop it after a given time. My aproach was to use: urllib.urlretrieve(ULR,FILENAME) It is fine! But how to stop the

Re: From Python to c++

2006-03-22 Thread Marco Aschwanden
Heck! I received 1 useless answer in comp.lang.c++ and here I get useful links/hints and even a code-pattern! Great. Thank you all. Sorry for posting a c++-problem here, but it was derived from my thinking the Python way... Cheers, Marco --

Re: How to kill/stop a Thread?

2006-03-22 Thread Fredrik Lundh
Dirk Zimmermann wrote: I like to do the following: Via http I get a stream of data and I like to store this data with a python program. So what I need is to start the downloading and to stop it after a given time. My aproach was to use: urllib.urlretrieve(ULR,FILENAME) It is fine! But

Re: py web-app-frameworks without a rdbms...

2006-03-22 Thread Anand
Try web.py. Very simple and powerful web framework. http://webpy.org -anand -- http://mail.python.org/mailman/listinfo/python-list

Re: ** Operator

2006-03-22 Thread Christoph Zwerschke
Georg Brandl wrote: Had I seen the tracker item and/or read this thread to the end before I made that checkin, I probably wouldn't have made it... ;) But then we would have never known that the Python gods are only people ;-) -- http://mail.python.org/mailman/listinfo/python-list

multiple assignment

2006-03-22 Thread Anand
Suppose i have a big list and i want to take tke the first one and rest of the list like car/cdr in lisp. is there any easy way to do this in python? Only way i know is a = range(10) x, y = a[0], a[1:] In perl, it is possible to do multiple assignment like this @a = (1, 2, 3); ($x, @y) =

Re: py web-app-frameworks without a rdbms...

2006-03-22 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Of TurboGers Django WAF candidates, which one would be easier to use in an environment where the data/content doesn't come an RDBMS, but from other server-side apps... Django is trivial to use for this (but you still want to use a DB together with the built-in admin

Re: Using yacas within Python for symbolis computation

2006-03-22 Thread JCDenton
No I am actually not :) Mudcat wrote: Out of curiosity, are you also Texas Longhorn JCDenton in another online life? -- http://mail.python.org/mailman/listinfo/python-list

Re: Which GUI toolkit is THE best?

2006-03-22 Thread Piet van Oostrum
Michael Ekstrand [EMAIL PROTECTED] (ME) wrote: ME I've used both wxPython and PyGTK. I find wxPython to be horribly ME un-pythonic; combining that some problems on the Mac, and some ME other installation/environment issues, I ditched it for PyGTK. But AFAIK GTK doesn't have a native

Re: markup.py - HTML/XML generator

2006-03-22 Thread Gerard Flanagan
Fredrik Lundh wrote: Gerard Flanagan wrote: Now I can do this: page = HtmlPage('Test Page') navbar = page.div(id='left').ul(css='navbar') for href,link in {'/home':'Home', '/shop':'Shop', '/cart':'Cart'}.iteritems(): navbar.li.a(link,href=href)

Re: multiple assignment

2006-03-22 Thread Christoph Zwerschke
Anand schrieb: Suppose i have a big list and i want to take tke the first one and rest of the list like car/cdr in lisp. is there any easy way to do this in python? Only way i know is a = range(10) x, y = a[0], a[1:] You have so many higher-level ways to access and iterate through lists

Re: Use of Python with GDAL. How to speed up ?

2006-03-22 Thread Julien Fiore
Thanks for the psyco information, Serge. 2) Rewrite the code to be vectorized (don't use psyco) Right now your code *doesn't* get any speed benefit from numpy I do not understand this point. How to rewrite the code ? Do you mean in C ? Julien --

Re: multiple assignment

2006-03-22 Thread Fredrik Lundh
Christoph Zwerschke wrote: You're right, that would not be so far off. But then, the following should be also supported: *x, y = a # x, y = a[:-1], y = a[-1] x, *y, z = a # x, y, z = a[0], a[1:-1], a[-1] Of course, there can be only one variable with an asterisk. (But note that in the

Re: Use of Python with GDAL. How to speed up ?

2006-03-22 Thread Julien Fiore
Thanks Caleb for the advice, I profiled my code with the following lines: import profile, pstats profile.runctx('openness(infile,outfile,R)',globals(),locals(),'profile.log') p = pstats.Stats('profile.log') p.sort_stats('time') p.print_stats(10) The outputs tells me that the

Re: Multifile EOF error

2006-03-22 Thread [EMAIL PROTECTED]
Try to trim down your script to the minimal code that produces the error and post both. Copy'n'paste code and traceback, don't retype it. The code is kinda bit long so you can see the whole idea. I use some libgmail and twisted web #code start def displayComment(request): gmc =

Using MAPI (simplemapi.py)

2006-03-22 Thread Tomas Brabenec
Hi all, i need open new messages in default e-mail client from my application in windows. I using simplemapi.py (http://www.kirbyfooty.com/simplemapi.py) But not worked correctly. This is a error message: Traceback (most recent call last): File Q:\Notebook\frmApp.py, line 206, in

Per instance descriptors ?

2006-03-22 Thread bruno at modulix
Hi I'm currently playing with some (possibly weird...) code, and I'd have a use for per-instance descriptors, ie (dummy code): class DummyDescriptor(object): def __get__(self, obj, objtype=None): if obj is None: return self return getattr(obj, 'bar', 'no bar') class

Re: Importing two module variables and having one clobber the other?

2006-03-22 Thread Mike Mazurek
You could wrap your paramter dict in a class instance with something like:class Parameters(object): def __init__(self, parameterDict): self.__dict__ = parameterDict.copy() # NB: copying may not be necissary for your case parms = Parameters(dict(a=1,b=2,c=3))print parms.a, parms.b, parms.cOn 21 Mar

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-22 Thread Dinko Tenev
funkyj wrote: How about the other iterator characteristics? when there is a huge solution space can I ask the prolog version to give me the first 1000 solutions? Geoffrey's post above offers one way to do this from within a REPL. Within a program, as soon as you accept a solution, you're

Default/editable string to raw_input

2006-03-22 Thread Paraic Gallagher
Hi, This is my first post to the list, I hope somebody can help me with this problem. Apologies if it has been posted before but I have been internet searching to no avail. What I am trying to do is provide a simple method for a user to change a config file, for a test suite. The config file

Re: Which GUI toolkit is THE best?

2006-03-22 Thread Renato
Hardly a showstopper: gtk works now (with X11), and will work even better soon (native). :-) -- Ciao, Renato -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-22 Thread Dinko Tenev
OK, here's a case that will make your program run in exponential time: S = { a, b }, W = { *a*b, *b*a } -- on my machine, it starts getting ugly as soon as n is 15 or so. Note that S^n - W = { a^n, b^n }. In general, whenever all the patterns in the set match against the last position, your

RE: From Python to c++

2006-03-22 Thread Ames Andreas
Hello Marco, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] g] On Behalf Of Marco Aschwanden Sent: Tuesday, March 21, 2006 8:43 PM Subject: From Python to c++ parsed = { name:[Mac, Mike], age:[25, 55], place:[Zurich, Oslo] } mapstring,

Server.sendmail with no to_addrs parameter.

2006-03-22 Thread EdWhyatt
Hi all, I have searched the group with no answer to this particular problem. In my sendmail program, I would like to have the ability to send a mail message with no-one email address in the To field. I do this by adding the mail to the CC field via a header. However, by the time I get to the

Re: Server.sendmail with no to_addrs parameter.

2006-03-22 Thread Tim Williams (gmail)
On 22 Mar 2006 03:18:41 -0800, EdWhyatt [EMAIL PROTECTED] wrote: Hi all, I have searched the group with no answer to this particularproblem.In my sendmail program, I would like to have the ability to send a mailmessage with no-one email address in the To field. I do this by adding the mail to the

Some info

2006-03-22 Thread Fulvio
Hello, I'm very new of Python programming. I just wrote some hundred lines of a programm. Now, I'd like to go some step farther and make a disk cataloger. There are plenty for win, but few for linux. So, I'd like to write one which is for win and linux. I'm, actually, a bit stuck on how to

roobtic

2006-03-22 Thread sonercafri
http://www.sanalmerkez.gq.nu -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. Java gzip performance

2006-03-22 Thread Felipe Almeida Lessa
Em Qua, 2006-03-22 às 00:47 +0100, Martin v. Löwis escreveu: Caleb Hattingh wrote: What does .readlines() do differently that makes it so much slower than .read().splitlines(True)? To me, the one obvious way to do it is .readlines(). [snip] Anyway, decompressing the entire file at one

Re: py web-app-frameworks without a rdbms...

2006-03-22 Thread bruno at modulix
[EMAIL PROTECTED] wrote: Hi folks, Of TurboGers Django WAF candidates, which one would be easier to use in an environment where the data/content doesn't come an RDBMS, but from other server-side apps... IMHO, both. If these are not good candidates, could you suggest appropriate ones...

Re: Some info

2006-03-22 Thread Sybren Stuvel
Fulvio enlightened us with: Now, I'd like to go some step farther and make a disk cataloger. What kind of disk? Harddisks? DVDs? Audio CDs? I'm, actually, a bit stuck on how to collect informations regarding disk names (CDroms or USB HDs). Depends on what names you want. Filenames? Track

Re: Use of Python with GDAL. How to speed up ?

2006-03-22 Thread Kent Johnson
Julien Fiore wrote: Thanks Caleb for the advice, I profiled my code with the following lines: import profile, pstats profile.runctx('openness(infile,outfile,R)',globals(),locals(),'profile.log') p = pstats.Stats('profile.log') p.sort_stats('time') p.print_stats(10)

Re: Default/editable string to raw_input

2006-03-22 Thread Sybren Stuvel
Paraic Gallagher enlightened us with: What I am trying to do is provide a simple method for a user to change a config file, for a test suite. My opinion: let the user edit the configuration file using his/her favourite text editor. Someone configuring a test suite should certainly be able to

Re: Some info

2006-03-22 Thread Fulvio
Alle 21:22, mercoledì 22 marzo 2006, Sybren Stuvel ha scritto: disk names (CDroms or USB HDs). Depends on what names you want. It seems clear that was _disk_ names. If isn't to much would be also useful to know the serial number, so will avoid to record a disk twice. On Win, we can call

struct size confusion:

2006-03-22 Thread Michael Yanowitz
Hello: I am relatively new to Python and this is my first post on this mailing list. I am confused as to why I am getting size differences in the following cases: print struct.calcsize(I) 4 print struct.calcsize(H) 2 print struct.calcsize(HI) 8 print struct.calcsize(IH) 6 Why is

Re: Default/editable string to raw_input

2006-03-22 Thread Paraic Gallagher
Sybren Stuvel wrote: My opinion: let the user edit the configuration file using his/her favourite text editor. Someone configuring a test suite should certainly be able to edit a text file. Sybren While I agree in principal to your opinion, the idea is that an absolute moron would be able

Re: Using Dictionaries in Sets - dict objects are unhashable?

2006-03-22 Thread Gregory Piñero
Thanks guys. That was informative and helpful. I'm back on track now. -Greg On 21 Mar 2006 17:30:47 -0800, Ben Cartwright [EMAIL PROTECTED] wrote: Gregory Piñero wrote: Hey guys, I don't understand why this isn't working for me. I'd like to be able to do this. Is there another

Re: Some info

2006-03-22 Thread Sybren Stuvel
Fulvio enlightened us with: Alle 21:22, mercoledì 22 marzo 2006, Sybren Stuvel ha scritto: disk names (CDroms or USB HDs). Depends on what names you want. It seems clear that was _disk_ names. What's a disk name? The filesystem label works as a disk name for ISO-9660 CDROMs, but entire

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-22 Thread Mark Carter
Mark Carter wrote: At the risk of being labelled a troll One thing I just discovered, and by which I mean *really* discovered ... is that Lisp is an interactive environment. I am working on trying to verify the contents of disks. I noticed that the input formats are slightly wrong, and

Re: struct size confusion:

2006-03-22 Thread Diez B. Roggisch
Michael Yanowitz wrote: Why is it 8 bytes in the third case and why would it be only 6 bytes in the last case if it is 8 in the previous? From TFM: Native size and alignment are determined using the C compiler's sizeof expression. This is always combined with native byte order. Standard

Re: struct size confusion:

2006-03-22 Thread Kent Johnson
Michael Yanowitz wrote: Hello: I am relatively new to Python and this is my first post on this mailing list. I am confused as to why I am getting size differences in the following cases: print struct.calcsize(I) 4 print struct.calcsize(H) 2 print struct.calcsize(HI)

Re: struct size confusion:

2006-03-22 Thread Fredrik Lundh
Michael Yanowitz wrote: I am relatively new to Python and this is my first post on this mailing list. I am confused as to why I am getting size differences in the following cases: print struct.calcsize(I) 4 print struct.calcsize(H) 2 print struct.calcsize(HI) 8 print

Re: Default/editable string to raw_input

2006-03-22 Thread Sybren Stuvel
Paraic Gallagher enlightened us with: While I agree in principal to your opinion, the idea is that an absolute moron would be able to configure a testcell with smallest amount of effort possible. Then explain to me why learning how to use your program to edit the file is easier than using an

string.upto() and string.from()

2006-03-22 Thread [EMAIL PROTECTED]
I often need to re-code for myself a small code snippet to define string.upto() and string.from(), which are used like : # canonical examples 1234456789.upto(45) '1234' 123456dd987.from('d') 'd987' # if not found, return whole string hello, world !.upto(#) hello, world ! uhello, world

Re: nested for loops

2006-03-22 Thread John Salerno
Jesus Rivero - (Neurogeek) wrote: It is, but range(2,2) doesn't do anything Jesus Rivero - Neurogeek John Salerno wrote: Can someone tell me why 'n' in this example isn't 2? for n in range(2, 10): for x in range(2, n): print 'x =', x, 'n =', n x =

Re: Per instance descriptors ?

2006-03-22 Thread Ziga Seilnacht
bruno at modulix wrote: Hi I'm currently playing with some (possibly weird...) code, and I'd have a use for per-instance descriptors, ie (dummy code): snip Now the question: is there any obvious (or non-obvious) drawback with this approach ? Staticmethods won't work anymore: class

Re: multiple assignment

2006-03-22 Thread Anand
You're right, that would not be so far off. But then, the following should be also supported: *x, y = a # x, y = a[:-1], y = a[-1] x, *y, z = a # x, y, z = a[0], a[1:-1], a[-1] Of course, there can be only one variable with an asterisk. (But note that in the situation of a function taking

Refreshing Active Desktop Window

2006-03-22 Thread rodmc
I have written a small program which updates and HTML page in an active desktop (Internet Explorer) window. At present whenever it is refreshed it redraws the whole screen, I am using a very basic script from a Win32 example I found a while ago. Is there a way I can refresh the Window only and

reading binary data written in C

2006-03-22 Thread Sheldon
Hi, I have a script that I want to use to read some binary lon and lat data that was written with a C program. My script looks like this:  lat = open(lat_file,'rb').read() lat = Numeric.fromstring(lat) print len(lat) print lat[0] Results: 1476225 -995001790 Or using the Float typecode:

Re: Default/editable string to raw_input

2006-03-22 Thread David Wahler
Paraic Gallagher wrote: Hi, This is my first post to the list, I hope somebody can help me with this problem. Apologies if it has been posted before but I have been internet searching to no avail. What I am trying to do is provide a simple method for a user to change a config file, for a

Re: string.upto() and string.from()

2006-03-22 Thread Tim Williams (gmail)
On 22 Mar 2006 06:41:32 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I often need to re-code for myself a small code snippet to definestring.upto() and string.from(), which are used like : [snip] # if not found, return whole string hello, world !.upto(#) hello, world ! uhello, world

Re: Server.sendmail with no to_addrs parameter.

2006-03-22 Thread Arne Ludwig
Can anyone suggest how I can get round this? I have attempted numerous things, like making my recipient list = [''], but Exchange then tried to send the mail to [EMAIL PROTECTED] . rfc822: Note that the Bcc field may be empty, while the To field rfc822: is required to have at least

Re: string.upto() and string.from()

2006-03-22 Thread Duncan Booth
[EMAIL PROTECTED] wrote: I often need to re-code for myself a small code snippet to define string.upto() and string.from(), which are used like : snip Nothing very complicated to make with find and rfind, but wouldn't this be handy to have it ready in the common string method ? Something

Re: string.upto() and string.from()

2006-03-22 Thread Tim Williams (gmail)
On 22/03/06, Tim Williams (gmail) [EMAIL PROTECTED] wrote: if uh in uhello, world ! and uhello, world !.from(h): return uhello, world ! else: # not really required, used for demonstration only return :) OK, python allows me to code faster than I can think ( not that hard really!! )

Re: string.upto() and string.from()

2006-03-22 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I often need to re-code for myself a small code snippet to define string.upto() and string.from(), which are used like : # canonical examples 1234456789.upto(45) '1234' 123456dd987.from('d') 'd987' # if not found, return whole string hello, world !.upto(#)

Re: doctest, unittest, or if __name__='__main__'

2006-03-22 Thread john_sips_tea
so you think that a why all this creativity when you could just standardize on something ported from java, and throw away every- thing else post is friendly ? really ? Sorry for the sloppy writing. Thanks for clarifying. I wrote: If unittest is the standard way to write test code, why do we

RE: struct size confusion:

2006-03-22 Thread Michael Yanowitz
Thanks for your and everyone else's feedback. I got it to work now by prefixing the PACK_FORMAT with !. I previously thought I could only use the !' with the unpack. I still don't fully understand the byte allignment stuff (I am sure I will get it eventually), but I am content that it is working

Windows getting local ip address

2006-03-22 Thread SolaFide
On Linux, it is a simple matter to get the local ip address with system.os(ifconfig /tmp/ip); ip=open(/tmp/ip).readlines(), etc. How can I do this with Windows? -- http://mail.python.org/mailman/listinfo/python-list

Re: Per instance descriptors ?

2006-03-22 Thread bruno at modulix
Ziga Seilnacht wrote: bruno at modulix wrote: Hi I'm currently playing with some (possibly weird...) code, and I'd have a use for per-instance descriptors, ie (dummy code): snip Now the question: is there any obvious (or non-obvious) drawback with this approach ? Staticmethods

Re: Default/editable string to raw_input

2006-03-22 Thread Paraic Gallagher
David Wahler wrote: With the disclaimer that, as others have said, this may not be the best user-interface choice: import readline readline.set_startup_hook(lambda: readline.insert_text(old_value)) try: new_value = raw_input() finally: readline.set_startup_hook(None) Note that,

Re: reading binary data written in C

2006-03-22 Thread Grant Edwards
On 2006-03-22, Sheldon [EMAIL PROTECTED] wrote: I have a script that I want to use to read some binary lon and lat data that was written with a C program. http://www.python.org/doc/current/lib/module-struct.html -- Grant Edwards grante Yow! UH-OH!! We're out

Re: Windows getting local ip address

2006-03-22 Thread Fredrik Lundh
SolaFide wrote: On Linux, it is a simple matter to get the local ip address with system.os(ifconfig /tmp/ip); ip=open(/tmp/ip).readlines(), etc. ip = os.popen(ifconfig).readlines() is a bit more convenient. How can I do this with Windows? the command is called ipconfig in windows.

Re: Windows getting local ip address

2006-03-22 Thread utabintarbo
You can do essentially the same thing substituting ipconfig for ifconfig. Though I am sure there are better ways -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows getting local ip address

2006-03-22 Thread Arne Ludwig
The second solution can give really weird results though, e.g. on my Linux system I get: gethostbyaddr(gethostname()) ('linux.site', ['linux'], ['127.0.0.2']) A more flexible but potentially unportable way would be: import socket import fcntl import struct def get_ip_address(ifname): ...

Re: string.upto() and string.from()

2006-03-22 Thread Kent Johnson
Fredrik Lundh wrote: [EMAIL PROTECTED] wrote: I often need to re-code for myself a small code snippet to define string.upto() and string.from(), which are used like : FWIW this is pretty easy to do with str.split() and rsplit(): # canonical examples 1234456789.upto(45) '1234'

Re: Server.sendmail with no to_addrs parameter.

2006-03-22 Thread EdWhyatt
So it's a restriction of Python? What I am trying to simulate here is the sending of mail to addresses solely in the CC and/or BCC fields - both of which are possible through Outlook. -- http://mail.python.org/mailman/listinfo/python-list

import random module

2006-03-22 Thread DataSmash
Hi, When I import the random module at the python interpreter, it works fine: import random x = random.randint(1,55) print x 14 BUT, when I put the same code in a python script: * random.py: import random x = random.randint(1,55) print x and run it at the command line, I get: Traceback

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-22 Thread Alexander Schmolck
Mark Carter [EMAIL PROTECTED] writes: A programmers mindset is usually geared towards writing applications. What I'm currently doing in Lisp is building up functions as I need them. Using emacs, I can just C-x C-e to make my functions live, and when it's time to stop for the day, save my

Re: import random module

2006-03-22 Thread Diez B. Roggisch
DataSmash wrote: Hi, When I import the random module at the python interpreter, it works fine: import random x = random.randint(1,55) print x 14 BUT, when I put the same code in a python script: * random.py: ^^ There is your problem: you named your module random, so importing

Re: import random module

2006-03-22 Thread Benjamin Niemann
DataSmash wrote: Hi, When I import the random module at the python interpreter, it works fine: import random x = random.randint(1,55) print x 14 BUT, when I put the same code in a python script: * random.py: import random x = random.randint(1,55) print x and run it at the

Re: import random module

2006-03-22 Thread Daniel Dittmar
DataSmash wrote: Hi, When I import the random module at the python interpreter, it works fine: import random x = random.randint(1,55) print x 14 BUT, when I put the same code in a python script: * random.py: import random x = random.randint(1,55) print x and run it at the

Re: import random module

2006-03-22 Thread Jorge Godoy
DataSmash [EMAIL PROTECTED] writes: Hi, When I import the random module at the python interpreter, it works fine: import random x = random.randint(1,55) print x 14 BUT, when I put the same code in a python script: * random.py: import random x = random.randint(1,55) print x and

Re: import random module

2006-03-22 Thread Gerard Flanagan
DataSmash wrote: Hi, When I import the random module at the python interpreter, it works fine: import random x = random.randint(1,55) print x 14 BUT, when I put the same code in a python script: * random.py: import random x = random.randint(1,55) print x and run it at the

Re: import random module

2006-03-22 Thread Michael Tobis
1) remove the file random.pyc in your working directory 2) rename the file random.py to something else and run it. The import mechanism is looking for random.pyc or random.py, but you have already named your file that! Your current directory is above your library directory in python's search

Re: string.upto() and string.from()

2006-03-22 Thread [EMAIL PROTECTED]
Sure, you're right I forgot about rsplit ! I guess the negative indexes al could be done with sep.join(xyz.split(sep)[:index]) Thanks ! -- http://mail.python.org/mailman/listinfo/python-list

Objective Cairo

2006-03-22 Thread federico . pelloni
As pycairo is one of the less pythonish things I ever saw, it went into my mind to create some sort of objective wrapper over its python api making graphic manipulation much more coherent to the python way. As of the moment, I can: - create (and reorder) multiple layers (this is not present in

Re: import random module

2006-03-22 Thread Richard Brodie
Benjamin Niemann [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Don't name your script 'random.py' (or any other name from the stdlib). 'import random' will import the script itself (not the random module from the stdlib), which is not what you want. I discovered long, long ago

Re: Server.sendmail with no to_addrs parameter.

2006-03-22 Thread Jeffrey Froman
EdWhyatt wrote: I would like to have the ability to send a mail message with no-one email address in the To field. The to_addrs parameter is for the SMTP RCPT TO, which must contain at least one address. It has nothing to do with the To: header of the email. You can *also* add the recipient

Need help with restricting number of new objects a user script can create

2006-03-22 Thread vj
I'm building a large infrastructure with about 30 servers (all running linux). I allow my end users to write scripts which then get broken down in smaller parts and run across the 30 servers. The results from each individual run are combined and presented back to the user. I'm currently using

Re: import random module

2006-03-22 Thread DataSmash
Much Thanks! I deleted the random.pyc and renamed the script and everything is good! R.D. -- http://mail.python.org/mailman/listinfo/python-list

Re: import random module

2006-03-22 Thread DataSmash
Much Thanks! I deleted the random.pyc and renamed the script and everything is good! R.D. -- http://mail.python.org/mailman/listinfo/python-list

SciPy problem

2006-03-22 Thread Tommy Grav
I am new to Python and just downloaded ActivePython 2.4.2.10 on my Mac PPC with OS X 10.4.I added the numpy package (0.9.6-py2.4) and it imports fine. But when I try to import scipy (0.4.8-py2.4)I get an error: import scipyTraceback (most recent call last):  File "stdin", line 1, in ?  File

Re: import random module

2006-03-22 Thread Tomas Brabenec
You must rename Your script. Your script doesn't same name as calling module. Tomas Brabenec http://brabenec.net DataSmash napsal(a): Hi, When I import the random module at the python interpreter, it works fine: import random x = random.randint(1,55) print x 14 BUT,

Re: Need help with restricting number of new objects a user script can create

2006-03-22 Thread Sybren Stuvel
vj enlightened us with: how do I restrict the user from (inadvertently or maliciously) creating a large number of objects which will bring down the entire 100 nodes. Use ulimit to give them a limited amount of CPU time, memory etc. The kernel will then kill runaway processes. Sybren -- The

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-22 Thread Dirk Thierbach
[Had to drop alt.comp.lang.haskell, otherwise my newsserver doesn't accept it] Dinko Tenev [EMAIL PROTECTED] wrote: OK, here's a case that will make your program run in exponential time: S = { a, b }, W = { *a*b, *b*a } -- on my machine, it starts getting ugly as soon as n is 15 or so. Note

Wrap a dictionary in a class?

2006-03-22 Thread Joseph Turian
In another thread, it was recommended that I wrap a dictionary in a class. How do I do so? Joseph that thread: http://groups.google.com/group/comp.lang.python/browse_frm/thread/9a0fbdca450469a1/b18455aa8dbceb8a?q=turianrnum=1#b18455aa8dbceb8a --

creating custom options for custom widgets?

2006-03-22 Thread Alexandre Guimond
Hi all. I'm creating a new widget class using Tkinter (class inherited form Tkinter.Frame). This class creates a bunch of other widgets inside it that can be gridded either horizontally or vertically. I would like to provide the user of the class an option to change this layout on the fly, using

Re: Server.sendmail with no to_addrs parameter.

2006-03-22 Thread EdWhyatt
Ok, totally unrelated, and on that subject, I will make sure I always have a recipient in the To: field. - hey it works if I do that anyway! But are you serious about that RFC Compliant thing? Can anyone shed anymore light on this? I cannot believe that (regardless of our opinions of them)

Re: import random module

2006-03-22 Thread Michael Tobis
Wow. Six simultaneous responses! Python rocks! Anyway, I actually tried it, and persisted through the secondary confusion about the lurking .pyc file, so even though I'm in sixth place I get points for completeness... mt -- http://mail.python.org/mailman/listinfo/python-list

Newbie: Print question

2006-03-22 Thread Tommy Grav
Being new to Python I am getting a result I do not understand.I have a code that reads in a set of lines from a file, slits upthe lines and puts information into a list of class objects.    obslist = mpc.Read_Observations(options.in_fname) ;        for testobs in obslist:        print

Re: Python vs. Java gzip performance

2006-03-22 Thread Martin v. Löwis
Felipe Almeida Lessa wrote: def readlines(self, sizehint=None): if sizehint is None: return self.read().splitlines(True) # ... Is it okay? Or is there any embedded problem I couldn't see? It's dangerous, if the file is really large - it might exhaust your memory.

  1   2   3   >