Re: Threading and tkinter

2009-02-17 Thread Hendrik van Rooyen
"gert" wrote: > After reading the docs and seeing a few examples i think this should > work ? > Am I forgetting something here or am I doing something stupid ? > Anyway I see my yellow screen, that has to count for something :) > > from tkinter import * > from threading import Thread > > class

Re: can multi-core improve single funciton?

2009-02-17 Thread Steven D'Aprano
On Tue, 17 Feb 2009 14:30:27 +, Cameron Laird wrote: > In article , > Steven D'Aprano wrote: > . > . > . >>> And now for my version (which admitedly isn't really mine, and returns >>> slightly incorrect fib(n) for large values

Re: Musings: Using decorators to reduce duplicate exception handling

2009-02-17 Thread Gabriel Genellina
En Tue, 17 Feb 2009 21:12:57 -0200, J Kenneth King escribió: I recently started a project called TracShell (http://code.google.com/p/tracshell) where I make heavy use of the xmlrpclib core module. When the number of RPC calls was small, wrapping each call in try/except was acceptable. Howeve

Re: Best practice for upgrading the version of SQLite bundled with Python 2.6.1

2009-02-17 Thread Gabriel Genellina
En Wed, 18 Feb 2009 01:09:15 -0200, escribió: Are there best practice recommendations for upgrading the version of SQLite that comes bundled with versions of Python 2.5 and later? At least on Windows, you only have to replace sqlite3.dll (in the DLLs directory) with the new one, and that's

Announcing CVExp: A library for making linear programming easier

2009-02-17 Thread David Baird
Here is the PyPI page: http://pypi.python.org/pypi/cvexp/0.1 And here is the homepage: http://www.aclevername.com/projects/cvexp/ CVExp currently supports solving linear, integer linear, and quadratic optimization problems via lpsolve55, GLPK, and CVXOPT. There are packages readily ava

Re: Will multithreading make python less popular?

2009-02-17 Thread Michele Simionato
On Feb 18, 4:47 am, Graham Dumpleton wrote: > It is also a mistaken belief that you cannot take advantage of multi > cores with multiple threads inside of a single process using Python. > > What no one seems to remember is that when calls are made into Python > extension modules implemented in C c

Re: Python Module for console text formatting?

2009-02-17 Thread geremy condra
You can insert those codes just like you would any other character. If there's enough interest I can whip up a wrapper library for you. http://www.linux.gr/cgi-bin/man2html?console_codes+4 On Tue, Feb 17, 2009 at 11:19 PM, srinivasan srinivas < sri_anna...@yahoo.co.in> wrote: > > Hi, > Does anyo

Python Module for console text formatting?

2009-02-17 Thread srinivasan srinivas
Hi, Does anyone know any python module other than 'ConsoleFormat0.1.1' used to format text on console? For example, printing bold characters on console. Thanks, Srini Did you know? You can CHAT without downloading messenger. Go to http://in.webmessenger.yahoo.com/ -- http://mail.python.

Re: How do I declare global vars or class vars in Python ?

2009-02-17 Thread alex23
On Feb 18, 12:54 am, Linuxguy123 wrote: > The part I don't know to do is declare the variables, either as globals > or as vars in a class.  How is this done in Python without setting them > to a value ? Generally, you can use the object None to indicate that something has no value: class Somethi

Re: Will multithreading make python less popular?

2009-02-17 Thread Graham Dumpleton
On Feb 16, 9:27 pm, Michele Simionato wrote: > On Feb 16, 10:34 am, rushen...@gmail.com wrote: > > > > > Hi everybody, > > I am an engineer. I am trying to improve my software development > > abilities. I have started programming with ruby. I like it very much > > but i want to add something more.

multiprocessing module and os.close(sys.stdin.fileno())

2009-02-17 Thread Graham Dumpleton
Why is the multiprocessing module, ie., multiprocessing/process.py, in _bootstrap() doing: os.close(sys.stdin.fileno()) rather than: sys.stdin.close() Technically it is feasible that stdin could have been replaced with something other than a file object, where the replacement doesn't have a

Re: Is there something easier than ORM?

2009-02-17 Thread alex23
On Feb 18, 3:10 am, Robert Kern wrote: > Its public image definitely suffers from the impression that it's "an ORM" > that > can be compared on equal terms with packages that actually are just ORMs. I > describe it as a very powerful toolkit for solving a wide variety of problems > involving SQL

Best practice for upgrading the version of SQLite bundled with Python 2.6.1

2009-02-17 Thread python
Are there best practice recommendations for upgrading the version of SQLite that comes bundled with versions of Python 2.5 and later? We're running Python 2.6.1 on Windows and Linux and using the default version of SQLite that ship with this release. Today, a new version of SQLite 3.6.11 was releas

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread alex23
On Feb 18, 11:36 am, Paul Rubin wrote: > Thomas Allen writes: > > attempting. Basically, I'm transforming a live site to a local one and > > Something wrong with wget -R ? Did you mean wget -r ? That will just grab the entire site, though. I'm guessing that Thomas'

Questions on Python 2.6.1 locale module

2009-02-17 Thread python
I've read the latest official locale documentation[1], googled for additional resources, and have the following questions: 1. Does the following warning still apply to recent releases of Python (and if so, is this a Python issue, a generic C runtime issue, or a platform specific C runtime issue) ".

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 9:08 pm, Christian Heimes wrote: > Thomas Allen wrote: > > If you'd read the messages in this thread you'd understand why I'm not > > using os.walk(): I'm not using it because I need my code to be aware > > of the current recursion depth so that the correct number of "../" are > > subst

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Christian Heimes
Thomas Allen wrote: > If you'd read the messages in this thread you'd understand why I'm not > using os.walk(): I'm not using it because I need my code to be aware > of the current recursion depth so that the correct number of "../" are > substituted in. I'm well aware of your messages and your re

Re: List of locale values for locale.setlocale() under Windows

2009-02-17 Thread python
Gabriel, > Are you looking for this? > http://msdn.microsoft.com/en-us/library/hzz3tw78(VS.80).aspx Yes! Wonderful! Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 7:05 pm, Christian Heimes wrote: > Thomas Allen wrote: > > I'm referring to the same code, but with a print: > > > for file in os.listdir(dir): > >     if os.path.isdir(file): > >         print "D", file > > > in place of the internal call to absToRel...and only one line prints > > such

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Paul Rubin
Thomas Allen writes: > attempting. Basically, I'm transforming a live site to a local one and Something wrong with wget -R ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3D CAD -- need collaborators, or just brave souls :)

2009-02-17 Thread Dotan Cohen
> It has long been my dream to create an open source 3D CAD program and > i am starting to crawl my way into the first steps. If you are really serious, then I am waiting for a Linux-compatible Solidworks replacement. That means that I can work and collaborate with other Solidworks users in Solidw

Re: Jython Dev in Eclipse

2009-02-17 Thread Benjamin Kaplan
On Tue, Feb 17, 2009 at 4:55 PM, ntwrkd wrote: > Does anyone use Pydev or JyDT for Eclipse. > Can you recommend one against the other? JyDT hasn't had a release in the last few years. I don't think it will work with the new versions of eclipse or Jython. -- > http://mail.python.org/mailman/lis

Re: Searching Google?

2009-02-17 Thread Curt Hash
On Tue, Feb 17, 2009 at 4:15 PM, Oltmans wrote: > > Hey all, > > I want to search Google.com using a specific keyword and I just want > to read back the response using Pyhon. After some thorough Googling I > realized that I probably need a Search API key to do that. Is that > correct? Now, I don't

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Christian Heimes
Thomas Allen wrote: > I'm referring to the same code, but with a print: > > for file in os.listdir(dir): > if os.path.isdir(file): > print "D", file > > in place of the internal call to absToRel...and only one line prints > such a message. I mean, if I can't trust my OS or its Python

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread MRAB
Thomas Allen wrote: I must not be understanding something. This is a simple recursive function that prints all HTML files in argv[1] as its scans the directory's contents. Why do I get a RuntimeError for recursion depth exceeded? #!/usr/bin/env python import os, sys def main(): absToRel(sy

Re: List of locale values for locale.setlocale() under Windows

2009-02-17 Thread Gabriel Genellina
En Tue, 17 Feb 2009 18:00:19 -0200, escribió: locale.getlocale() ('English_United States', '1252') Any suggestions on where I can find the official list of locale codes for Windows XP (or better yet, all versions of Windows XP or later)? Are you looking for this? http://msdn.microsoft.com/en

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 6:05 pm, Peter Otten <__pete...@web.de> wrote: > Thomas Allen wrote: > > On Feb 17, 5:31 pm, Peter Otten <__pete...@web.de> wrote: > >> Thomas Allen wrote: > >> > I must not be understanding something. This is a simple recursive > >> > function that prints all HTML files in argv[1] as it

Re: _socket.so source?

2009-02-17 Thread Christian Heimes
mbarry schrieb: > Hello, > > > The socket module in Python uses _socket.so for most of its behavior. > I want to modify the code that generates the _socket.so file. > I need the source file and instructions on how to compile and build > _socket.so for Windows. > Can anyone point me to where I can

Re: Upgrading standard library module

2009-02-17 Thread Gabriel Genellina
En Tue, 17 Feb 2009 13:37:12 -0200, Bryan escribió: On Feb 17, 12:34 am, "Gabriel Genellina" wrote: En Fri, 13 Feb 2009 20:17:35 -0200, Bryan escribió: > On Feb 13, 1:52 pm, Jason Scheirer wrote: >> On Feb 13, 12:42 pm, Bryan wrote: >> > I have a Python v2.5.2 server running and I found

Re: Speedup Bitmap Parser

2009-02-17 Thread Peter Otten
Jayson Santos wrote: > On 17 fev, 14:00, bearophileh...@lycos.com wrote: >> Jayson Santos: >> >> > After changing my code to use only functions instead classes >> > my code is too much faster. >> > Here cProfile statistcs: >> > Using old code : 633608 function calls in 1.361 CPU seconds >> > Using

Making extension modules play nice with help()?

2009-02-17 Thread Nicholas Bastin
I've always provided doc strings through PyMethodDef in the past, without paying much attention to what happens in help() - they print fine when you just use the doc string. However, in help, you end up with methods that have an indeterminate signature. We generally make doc strings that look lik

Re: print string as raw string

2009-02-17 Thread Miles
On Tue, Feb 17, 2009 at 2:01 PM, Scott David Daniels wrote: >>> Mirko Dziadzka schrieb: I'm trying to find a way to output strings in the raw-string format, e.g. print_as_raw_string(r"\.") should output r"\." instead of "\\." ... > > ... > The big issue I see is that lots of va

Re: numpy.memmap advice?

2009-02-17 Thread Robert Kern
On 2009-02-17 17:08, Lionel wrote: Hello all, On a previous thread (http://groups.google.com/group/comp.lang.python/ browse_thread/thread/64da35b811e8f69d/67fa3185798ddd12? hl=en&lnk=gst&q=keene#67fa3185798ddd12) I was asking about reading in binary data. Briefly, my data consists of complex num

Searching Google?

2009-02-17 Thread Oltmans
Hey all, I want to search Google.com using a specific keyword and I just want to read back the response using Pyhon. After some thorough Googling I realized that I probably need a Search API key to do that. Is that correct? Now, I don't have a search key so is there a workaround? Please enlighten

Musings: Using decorators to reduce duplicate exception handling

2009-02-17 Thread J Kenneth King
I recently started a project called TracShell (http://code.google.com/p/tracshell) where I make heavy use of the xmlrpclib core module. When the number of RPC calls was small, wrapping each call in try/except was acceptable. However, this obviously will duplicate code all over the place. There ar

_socket.so source?

2009-02-17 Thread mbarry
Hello, The socket module in Python uses _socket.so for most of its behavior. I want to modify the code that generates the _socket.so file. I need the source file and instructions on how to compile and build _socket.so for Windows. Can anyone point me to where I can find the source and/or document

numpy.memmap advice?

2009-02-17 Thread Lionel
Hello all, On a previous thread (http://groups.google.com/group/comp.lang.python/ browse_thread/thread/64da35b811e8f69d/67fa3185798ddd12? hl=en&lnk=gst&q=keene#67fa3185798ddd12) I was asking about reading in binary data. Briefly, my data consists of complex numbers, 32-bit floats for real and imag

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Peter Otten
Thomas Allen wrote: > On Feb 17, 5:31 pm, Peter Otten <__pete...@web.de> wrote: >> Thomas Allen wrote: >> > I must not be understanding something. This is a simple recursive >> > function that prints all HTML files in argv[1] as its scans the >> > directory's contents. Why do I get a RuntimeError

Re: This application has failed to start because the application configuration is incorrect

2009-02-17 Thread Mark Hammond
On 18/02/2009 5:49 AM, Sam Clark wrote: I am receiving the message "This application has failed to start because the application configuration is incorrect" when I attempt to run a compiled Python program on another machine. I have used py2exe on both a 2.6.1 and a 2.6.0 version of the .py and .p

Re: Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

2009-02-17 Thread Miles
On Mon, Feb 16, 2009 at 8:35 PM, Helly John J. wrote: > However, when I run python and try to import gdal, this is what happens: > Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin > Type "help", "copyright", "credits" or "license" for more i

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 5:31 pm, Peter Otten <__pete...@web.de> wrote: > Thomas Allen wrote: > > I must not be understanding something. This is a simple recursive > > function that prints all HTML files in argv[1] as its scans the > > directory's contents. Why do I get a RuntimeError for recursion depth > > exc

Re: OpenGL in TK

2009-02-17 Thread Mike C. Fletcher
Almar Klein wrote: Hi list! I am using pyOpenGL to do some 3D rendering. For now I am quite happy with the GLCanvas of wx, but I may want to publish some stuff later, and it would be nice if people would not need wx. I found that there used to be a TK widget called Togl, but it is not (anymore?

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Peter Otten
Thomas Allen wrote: > I must not be understanding something. This is a simple recursive > function that prints all HTML files in argv[1] as its scans the > directory's contents. Why do I get a RuntimeError for recursion depth > exceeded? > > #!/usr/bin/env python > > import os, sys > > def main

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 4:46 pm, Thomas Allen wrote: > I must not be understanding something. This is a simple recursive > function that prints all HTML files in argv[1] as its scans the > directory's contents. Why do I get a RuntimeError for recursion depth > exceeded? > > #!/usr/bin/env python > > import os,

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Martin v. Löwis
Thomas Allen wrote: > I must not be understanding something. This is a simple recursive > function that prints all HTML files in argv[1] as its scans the > directory's contents. Why do I get a RuntimeError for recursion depth > exceeded? > > def main(): > absToRel(sys.argv[1], sys.argv[2]) >

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Christian Heimes
Thomas Allen schrieb: > I must not be understanding something. This is a simple recursive > function that prints all HTML files in argv[1] as its scans the > directory's contents. Why do I get a RuntimeError for recursion depth > exceeded? > > #!/usr/bin/env python > > import os, sys > > def mai

Jython Dev in Eclipse

2009-02-17 Thread ntwrkd
Does anyone use Pydev or JyDT for Eclipse. Can you recommend one against the other? -- http://mail.python.org/mailman/listinfo/python-list

"Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
I must not be understanding something. This is a simple recursive function that prints all HTML files in argv[1] as its scans the directory's contents. Why do I get a RuntimeError for recursion depth exceeded? #!/usr/bin/env python import os, sys def main(): absToRel(sys.argv[1], sys.argv[2]

Re: pythonic array subsetting

2009-02-17 Thread Robert Kern
On 2009-02-17 14:36, Nick Matzke wrote: Looks like "compress" is the right numpy function, but it took forever for me to find it... x = array([[1,2,3], [4,5,6], [7,8,9]], dtype=float) compress([1,2], x, axis=1) result: array([[ 1., 2.], [ 4., 5.], [ 7., 8.]]) No, that's actually not correct.

Re: Python 3D CAD -- need collaborators, or just brave souls :)

2009-02-17 Thread Josh Dukes
What kind of cad are you focused on? Mechanical cad, architecutal cad, or something else? If you're interested there have been some experiments with blender http://projects.blender.org/projects/blendercad/ http://blenderartists.org/forum/showthread.php?t=65559 Unfortunately I don't think anything

Re: pythonic array subsetting

2009-02-17 Thread Nick Matzke
Looks like "compress" is the right numpy function, but it took forever for me to find it... x = array([[1,2,3], [4,5,6], [7,8,9]], dtype=float) compress([1,2], x, axis=1) result: array([[ 1., 2.], [ 4., 5.], [ 7., 8.]]) Gary Herron wrote: Nick Matzke wrote: Hi, So I've g

Re: Will multithreading make python less popular?

2009-02-17 Thread Hyuga
On Feb 16, 4:34 am, rushen...@gmail.com wrote: > Hi everybody, > I am an engineer. I am trying to improve my software development > abilities. I have started programming with ruby. I like it very much > but i want to add something more. According to my previous research i > have designed a learning

Re: Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

2009-02-17 Thread Philip Semanchuk
On Feb 16, 2009, at 8:35 PM, Helly John J. wrote: Hi. I'm a newbie to python and am running: OS X 10.5.6 Python 2.5.4 Hi John, Are you using the system Python or have you installed another version? Cheers Philip and have run easy_install for gdal like this: /Library/Python/2.5/site

Re: Putting asterisks around text

2009-02-17 Thread Josh Dukes
> while understand_problem is False: > study("textbook") > > complete("homework") > > if want_help is True: > study("http://www.catb.org/~esr/faqs/smart-questions.html";) just a note but "if" and "while" evaluate variables as True or False without a verbose test. e.g.: while not underst

Re: Scanning a file character by character

2009-02-17 Thread Tim Chase
Josh Dukes wrote: In [401]: import shlex In [402]: shlex.split("""Joe went to 'the store' where he bought a "box of chocolates" and stuff.""") how's that work for ya? It works great if that's the desired behavior. However, the OP wrote about splitting the lines into separate words, not "

Re: Scanning a file character by character

2009-02-17 Thread Josh Dukes
In [401]: import shlex In [402]: shlex.split("""Joe went to 'the store' where he bought a "box of chocolates" and stuff.""") Out[402]: ['Joe', 'went', 'to', 'the store', 'where', 'he', 'bought', 'a', 'box of chocolates', 'and', 'stuff.'] how's that work for ya? http://docs.python.or

Re: Pythonic way to determine if one char of many in a string

2009-02-17 Thread Jervis Whitley
> > This moves the for-loop out of slow Python into fast C and should be much, > much faster for very large input. > _Should_ be faster. Here is my test on an XP system Python 2.5.4. I had similar results on python 2.7 trunk. WORD = 'g' * 100 WORD2 = 'g' * 50 + 'U' BIGWORD = 'g' * 1 + 'U'

List of locale values for locale.setlocale() under Windows

2009-02-17 Thread python
I'm experimenting with the locale module and have been unable to get the documentation examples to run on Windows XP. (The examples run fine on Linux). In particular, none of the locale.setlocale( category, locale )'s sample locale parameter values are considered valid. Example: >>> locale.setlocal

Re: Invoking CutePDF from within Python

2009-02-17 Thread John Henry
On Feb 13, 3:15 am, cm wrote: > Hi John,> All I need is to say "Print this to CUTEPDF and store as xyz.pdf". > > I can't answer you question but let me make a suggestion: Try > PdfCreator. It lets you control all the process using an activex > control. It has events to tell you when the jobs has f

Re: Kill a function while it's being executed

2009-02-17 Thread Robert Kern
On 2009-02-17 12:53, Noam Aigerman wrote: Hi, Sorry for resurrecting an old thread, but it just bothers me that this is the best way that python has to deal with killing running functions... it's quite an ugly hack, no? Is it a feature that's needed bit missing from python, or is it left out on

Re: wxPython and Croatian characters

2009-02-17 Thread Mike Driscoll
On Feb 17, 11:02 am, vedrandeko...@gmail.com wrote: > On 17 velj, 00:09, "alejandro" wrote: > > > Provjeri da si nisi stavio ansii kada si instalirao wx.python. > > Mozes probat ubacit iznad svega u fajlu komentar u kojem pise da je fajl u > > UTF-8 i onda bi ti trebalo sljakat. Nadem sutra pa ti

This application has failed to start because the application configuration is incorrect

2009-02-17 Thread Sam Clark
I am receiving the message "This application has failed to start because the application configuration is incorrect" when I attempt to run a compiled Python program on another machine. I have used py2exe on both a 2.6.1 and a 2.6.0 version of the .py and .pyw files. Everything works great on t

Re: Reading from text

2009-02-17 Thread Grant Edwards
On 2009-02-17, Tim Chase wrote: >> Assuming this is a real task and not a homework problem, then >> I'd do it this way: >> >> $ cd [directory containing 50 test files] >> $ (for file in *; do head -n11 $file | tail -n5; done) >> >/path/to/results-file.txt > > I'd use sed: > >sed -ns 7,11

Re: A python versioning scheme for modules, patches, softwares etc.

2009-02-17 Thread kretel
On Feb 17, 5:31 pm, Robert Kern wrote: > On 2009-02-17 11:16, kretel wrote: > > > There exist a number of versioning schemes to keep track of software > > version. Each developer certainly have it's own style and preferred > > scheme. However, I am wonder if there is a specific versioning scheme >

Re: print string as raw string

2009-02-17 Thread Scott David Daniels
Steven D'Aprano wrote: Diez B. Roggisch wrote: Mirko Dziadzka schrieb: I'm trying to find a way to output strings in the raw-string format, e.g. print_as_raw_string(r"\.") should output r"\." instead of "\\." ... In any case, this is just a variation of what repr() does. repr(r'\.') "'

Re: Is there something easier than ORM?

2009-02-17 Thread Martin v. Löwis
> So is there some libraries like that? I always use a DB-API implementation for the database I use, i.e. psycopg/psycopg2. Named tuples are really easy to provide: class NamedTuple: def __init__(self, names, values): for name, value in izip(names, values): setattr(self, name, valu

RE: Kill a function while it's being executed

2009-02-17 Thread Noam Aigerman
Hi, Sorry for resurrecting an old thread, but it just bothers me that this is the best way that python has to deal with killing running functions... it's quite an ugly hack, no? Is it a feature that's needed bit missing from python, or is it left out on purpose (same way like java has deprecated t

Re: Reading from text

2009-02-17 Thread Tim Chase
Assuming this is a real task and not a homework problem, then I'd do it this way: $ cd [directory containing 50 test files] $ (for file in *; do head -n11 $file | tail -n5; done) >/path/to/results-file.txt I'd use sed: sed -ns 7,11p /source/path/*.txt >/path/to/results.txt hard to get

Re: Speedup Bitmap Parser

2009-02-17 Thread bearophileHUGS
Jayson Santos: > And here is the final code:http://pastebin.com/f3e20d669 Note that if you use Psyco this lookup trick isn't useful, but if the Psyco isn't available it can improve performance a little: append = BitmapList['lines'].append I suggest to replace this code: red, green, blue

Re: printing bytes to stdout in Py3

2009-02-17 Thread Scott David Daniels
Casey wrote: ... Is this the 'official' way to do this?... Why wouldn't you just use: print(bytes.decode(b'abc\n'), end='') Because that code is incapable of sending bytes that cannot be interpreted as encoded in the "default" encoding. If you are sending a picture, for example, all possible

Re: printing bytes to stdout in Py3

2009-02-17 Thread Christian Heimes
Casey schrieb: > On Feb 17, 12:33 pm, Christian Heimes wrote: >> Yes, it's really the official way. You can google up the discussion >> between me and Guido on the python-dev list if you don't trust me. ;) >> The docs concur with me, too. >> >> http://docs.python.org/3.0/library/sys.html#sys.stdin

Re: printing bytes to stdout in Py3

2009-02-17 Thread Casey
On Feb 17, 12:33 pm, Christian Heimes wrote: > Yes, it's really the official way. You can google up the discussion > between me and Guido on the python-dev list if you don't trust me. ;) > The docs concur with me, too. > > http://docs.python.org/3.0/library/sys.html#sys.stdin > > Note: The standar

Re: Reading from text

2009-02-17 Thread Grant Edwards
On 2009-02-17, oamram wrote: > i have a directory with about 50 text file and i need to > iterate through them and get line 7 to 11 from each file and > write those lines into another file(one file that will contain > all lines). Assuming this is a real task and not a homework problem, then I'd

Re: Reading from text

2009-02-17 Thread MRAB
bearophileh...@lycos.com wrote: oamram: i have a directory with about 50 text file and i need to iterate through them and get line 7 to 11 from each file and write those lines into another file(one file that will contain all lines). Files can be iterated line-by-line, so this idiom: for line

Re: Threads vs. processes, what to consider in choosing ?

2009-02-17 Thread Christian Heimes
Philip Semanchuk wrote: > The general rule is that it is a lot easier to share data between > threads than between processes. The multiprocessing library makes the > latter easier but is only part of the standard library in Python >= 2.6. > The design of your application matters a lot. For instance

Re: Speedup Bitmap Parser

2009-02-17 Thread Jayson Santos
On 17 fev, 14:00, bearophileh...@lycos.com wrote: > Jayson Santos: > > > After changing my code to use only functions instead classes > > my code is too much faster. > > Here cProfile statistcs: > > Using old code : 633608 function calls in 1.361 CPU seconds > > Using new code: 475487 function call

Re: Reading from text

2009-02-17 Thread bearophileHUGS
oamram: > i have a directory with about 50 text file and i need to > iterate through them and get > line 7 to 11 from each file and write those lines into another > file(one file that will contain all lines). Files can be iterated line-by-line, so this idiom: for line in file: ... will give you

Posting multiple files via a web site.

2009-02-17 Thread pdl5000
I would like to start write a Python script that upload multiple files to a web server. I research the methods, and I am somewhat confused between using the http & urllib2 modules. I assume (and could be wrong) that the most basic method would be to use a cgi-Python script on the web server then

Re: printing bytes to stdout in Py3

2009-02-17 Thread Christian Heimes
Casey wrote: > Is this really the 'official' way to do this? This isn't meant to be > confrontational or trolling; I honestly don't know the answer and I > had similar questions when I first started with the 3.0 release > candidates and I have yet to find a good answer in the Python v3.0 > documen

Re: A python versioning scheme for modules, patches, softwares etc.

2009-02-17 Thread Robert Kern
On 2009-02-17 11:16, kretel wrote: There exist a number of versioning schemes to keep track of software version. Each developer certainly have it's own style and preferred scheme. However, I am wonder if there is a specific versioning scheme for python modules. A number of Python tools that man

Re: printing bytes to stdout in Py3

2009-02-17 Thread Peter Billam
On 2009-02-17, Christian Heimes wrote: > Peter Billam schrieb: >> Greetings. (Newbie warning as usual) In Python3, sys.stdout is a >> io.TextIOWrapper object; but I want to output bytes >> (e.g. muscript -midi t > t.mid ) >> and they're coming out stringified :-( How can I either change the >>

A python versioning scheme for modules, patches, softwares etc.

2009-02-17 Thread kretel
There exist a number of versioning schemes to keep track of software version. Each developer certainly have it's own style and preferred scheme. However, I am wonder if there is a specific versioning scheme for python modules. Regards, Krzysztof -- http://mail.python.org/mailman/listinfo/python-li

Re: Reading from text

2009-02-17 Thread JB
oamram a écrit : Hi All, new to python. i have a directory with about 50 text file and i need to iterate through them and get line 7 to 11 from each file and write those lines into another file(one file that will contain all lines). First create a function that read and parse one file Then cre

Re: Is there something easier than ORM?

2009-02-17 Thread Robert Kern
On 2009-02-17 10:52, andrew cooke wrote: Philip Semanchuk wrote: In short, I gather that others on this list are a lot more fond of SqlAlchemy and ORMs in general than I am. Granted, my experience is very limited. I tried to integrate SqlAlchemy in one project, struggled for a long time to expre

Python-URL! - weekly Python news and links (Feb 17)

2009-02-17 Thread Gabriel Genellina
QOTW: "The hardest part of design ...is keeping features out." - Donald Norman, design guru and former Apple exec https://www.technologyreview.com/business/18621/ Two short recipes: Determine whether a string is a number or not: http://groups.google.com/group/comp.lang

Re: Threads vs. processes, what to consider in choosing ?

2009-02-17 Thread Philip Semanchuk
On Feb 17, 2009, at 10:18 AM, Barak, Ron wrote: I have a wxPython application that builds an internal database from a list of files and then displays various aspects of that data, in response to user's requests. I want to add a module that finds events in a set of log files (LogManager). T

Re: wxPython and Croatian characters

2009-02-17 Thread vedrandekovic
On 17 velj, 00:09, "alejandro" wrote: > Provjeri da si nisi stavio ansii kada si instalirao wx.python. > Mozes probat ubacit iznad svega u fajlu komentar u kojem pise da je fajl u > UTF-8 i onda bi ti trebalo sljakat. Nadem sutra pa ti posaljem Pozdrav / Hello, It works now, all post were very u

Re: Speedup Bitmap Parser

2009-02-17 Thread bearophileHUGS
Jayson Santos: > After changing my code to use only functions instead classes > my code is too much faster. > Here cProfile statistcs: > Using old code : 633608 function calls in 1.361 CPU seconds > Using new code: 475487 function calls in 0.800 CPU seconds If you show a pastebin of the new versio

Reading from text

2009-02-17 Thread oamram
Hi All, new to python. i have a directory with about 50 text file and i need to iterate through them and get line 7 to 11 from each file and write those lines into another file(one file that will contain all lines). Cheers, Omer. -- View this message in context: http://www.nabble.com/Reading-fr

Threading and tkinter

2009-02-17 Thread gert
After reading the docs and seeing a few examples i think this should work ? Am I forgetting something here or am I doing something stupid ? Anyway I see my yellow screen, that has to count for something :) from tkinter import * from threading import Thread class Weegbrug(Thread): def __init__

Re: Will multithreading make python less popular?

2009-02-17 Thread Christian Heimes
rushen...@gmail.com wrote: > As you mentioned, using multi cores makes programs more fast and more > popular. But what about stackless python? Does it interpret same set > of python libraries with Cpython or Does it have a special sub set? Your assumption is wrong. Multiple cores are able to speed

Re: Is there something easier than ORM?

2009-02-17 Thread andrew cooke
Philip Semanchuk wrote: > In short, I gather that others on this list are a lot more fond of > SqlAlchemy and ORMs in general than I am. Granted, my experience is > very limited. I tried to integrate SqlAlchemy in one project, > struggled for a long time to express how I wanted my tables joined, >

Re: Is there something easier than ORM?

2009-02-17 Thread Tim Golden
Philip Semanchuk wrote: [... snip comments on SqlAlchemy which could likewise apply to other similar offerings ...] I don't intend this as a criticism of SqlAlchemy. On the contrary I am impressed by what it does. But I often see people promoting ORM as the solution to all database access prob

Re: Is there something easier than ORM?

2009-02-17 Thread Philip Semanchuk
On Feb 17, 2009, at 7:27 AM, 一首诗 wrote: Hi all, Recently I am studying some python ORM libraries, such as sqlalchemy. These are very powerful technologies to handle database. But I think my project are not complicated to enough to benefit from a complete ORM system. What I really want, is s

Re: printing bytes to stdout in Py3

2009-02-17 Thread Casey
On Feb 17, 7:28 am, Christian Heimes wrote: > Peter Billam schrieb: > > > Greetings. (Newbie warning as usual) In Python3, sys.stdout is a > > io.TextIOWrapper object; but I want to output bytes > >   (e.g. muscript -midi t > t.mid ) > > and they're coming out stringified :-(  How can I either cha

Re: Python change a value of a variable by itself.

2009-02-17 Thread Tim Chase
I have the following simple code: r = {} r[1] = [0.00] r_new = {} print r[1][0] r_new[1] = r[1] r_new[1][0] = r[1][0] + 0.02 print r[1][0] It outputs: 0.0 0.02 it is something strange to me since in the first and second case I output the same variable (r[1][0]) and it the two cases it has

Re: How do I declare global vars or class vars in Python ?

2009-02-17 Thread Duncan Booth
"Paddy O'Loughlin" wrote: > True, but you can use the global statement to refer to the variable > within a function and read from the variable there, without it being > already initialised in the module. You don't need the global statement unless you plan to *write* the variable from the functi

Re: Python change a value of a variable by itself.

2009-02-17 Thread Stephen Hansen
On Tue, Feb 17, 2009 at 8:19 AM, Kurda Yon wrote: > r_new[1] = r[1] This is the problem. "r" is a dictionary, a set of key/object pairs in essence. You're making the object that "r[1]" is pointing to a list, a mutable sequence of items. The expression "r[1]" will then return that list object and

Python change a value of a variable by itself.

2009-02-17 Thread Kurda Yon
Hi, I have the following simple code: r = {} r[1] = [0.00] r_new = {} print r[1][0] r_new[1] = r[1] r_new[1][0] = r[1][0] + 0.02 print r[1][0] It outputs: 0.0 0.02 it is something strange to me since in the first and second case I output the same variable (r[1][0]) and it the two cases it ha

Re: memory recycling/garbage collecting problem

2009-02-17 Thread Christian Heimes
Tim Wintle wrote: > Basically malloc() and free() are computationally expensive, so Python > tries to call them as little as possible - but it's quite clever at > knowing what to do - e.g. if a list has already grown large then python > assumes it might grow large again and keeps hold of a percenta

  1   2   >