Re: Define a constant in Python C extension

2009-02-27 Thread Stefan Behnel
fredbasset1...@gmail.com wrote: > I'm writing a C extension for Python, is it possible to define > constants in the C code and have them visible from Python? Have you looked at Cython? It allows you to define e.g. enums as "public" and will generate the rest for you. http://cython.org Stefan --

Re: what does this mean....?

2009-02-27 Thread zaheer . agadi
On Feb 28, 10:50 am, "Rhodri James" wrote: > On Sat, 28 Feb 2009 05:17:41 -, wrote: > > I am trying to download a file from the server, I am getting this > > error,what does this mean > > >localFile = open(localFileName, 'wb') > > TypeError: coercing to Unicode: need string or buffer, typ

Re: How do I count the distance between strings in a list?

2009-02-27 Thread Ken Seehart
collin wrote: For example, if I were to have the code randomlist = ["1", "2", "3", "4"] And I want to count the distance between strings "1" and "4" which is 3, what command can I use to do this? -- http://mail.python.org/mailman/listinfo/python-list randomlist.index("4") - randomlist.inde

Re: what does this mean....?

2009-02-27 Thread John Machin
On Feb 28, 4:17 pm, zaheer.ag...@gmail.com wrote: > I am trying to download a file from the server, I am getting this > error,what does this mean > >    localFile = open(localFileName, 'wb') > TypeError: coercing to Unicode: need string or buffer, type found the name localFileName is bound to a ty

Re: what does this mean....?

2009-02-27 Thread Rhodri James
On Sat, 28 Feb 2009 05:17:41 -, wrote: I am trying to download a file from the server, I am getting this error,what does this mean localFile = open(localFileName, 'wb') TypeError: coercing to Unicode: need string or buffer, type found The rest of the traceback and enough of your code

Re: Proposed implementation for an Ordered Dictionary

2009-02-27 Thread Raymond Hettinger
[Steve Holden] > A sort of premature pessimization, then. QOTW! _ ~ @ @ \_/ Raymond -- http://mail.python.org/mailman/listinfo/python-list

what does this mean....?

2009-02-27 Thread zaheer . agadi
I am trying to download a file from the server, I am getting this error,what does this mean localFile = open(localFileName, 'wb') TypeError: coercing to Unicode: need string or buffer, type found -- http://mail.python.org/mailman/listinfo/python-list

Re: What's so wrong about execfile?

2009-02-27 Thread Carl Banks
On Feb 27, 7:21 pm, Sammo wrote: > Given that execfile has been removed in py3k, I want to understand > exactly why. > > Okay, I get that execfile is bad from the following thread: > > On Jul 29 2007, 2:39 pm, Steven D'Aprano > > > > wrote: > > (1) Don't use eval, exec or execfile. > > > (2) If y

Re: Queries

2009-02-27 Thread Steve Holden
Dennis Lee Bieber wrote: > On Fri, 27 Feb 2009 15:39:13 -0800 (PST), mmcclaf > declaimed the following in gmane.comp.python.general: > >> This came in the Python groups, and I put one up in the database >> group, since I will later have to use Python to access the SQL file, [...] >> The relationa

What's so wrong about execfile?

2009-02-27 Thread Sammo
Given that execfile has been removed in py3k, I want to understand exactly why. Okay, I get that execfile is bad from the following thread: On Jul 29 2007, 2:39 pm, Steven D'Aprano wrote: > (1) Don't use eval, exec or execfile. > > (2) If you're an expert, don't use eval, exec or execfile. > > (

Re: Guidance on writing a top-like console

2009-02-27 Thread alex23
On Feb 28, 8:08 am, ntwrkd wrote: > I am interested in writing an application that functions like a Unix > or Linux top in the way it displays data. > It should be command-line based but dynamically refreshing. > > I'm not sure what I should take into account or how I might go about > implementing

Re: pep 8 constants

2009-02-27 Thread Ethan Furman
Steve Holden wrote: Gabriel Genellina wrote: En Tue, 24 Feb 2009 22:52:20 -0200, Ethan Furman escribió: Steve Holden wrote: Brian Allen Vanderburg II wrote: One idea to make constants possible would be to extend properties to be able to exist at the module level as well as the class le

Re: logging.Handler not working with QThreads

2009-02-27 Thread Vinay Sajip
On Feb 25, 11:57 pm, Lukas Hetzenecker wrote: > Hello, > > I created a QTextEdit where I wanted to display log messages. > A logging.Handler should do this job. > > It worked with one thread well, but when I start a QThread the text on all > widgets is removed and I get many errors in my konsole:

Re: why cannot assign to function call

2009-02-27 Thread Rhodri James
On Fri, 27 Feb 2009 23:55:43 -, Ethan Furman wrote: I'm not Mark, but you did post to the whole group! [snippety snip] Specifically, how is a new name (pbr) different, in Python, from a new name initialized as if by assignment (pbv)? It seems to me than you end up with the same thin

Re: logging.Handler not working with QThreads

2009-02-27 Thread Vinay Sajip
On Feb 25, 11:57 pm, Lukas Hetzenecker wrote: > Hello, > > I created a QTextEdit where I wanted to display log messages. > A logging.Handler should do this job. > > It worked with one thread well, but when I start a QThread the text on all > widgets is removed and I get many errors in my konsole:

Re: why cannot assign to function call

2009-02-27 Thread Ethan Furman
Mark Wooding wrote: Steven D'Aprano wrote: > On the one hand, some people (me and possibly rurpy) consider "this is pass-by-foo" to be a statement about behaviour directly visible to the programmer. We have a set of behavioral traits in mind, and if a language exhibits those behaviours, then

Re: Queries

2009-02-27 Thread mmcclaf
This came in the Python groups, and I put one up in the database group, since I will later have to use Python to access the SQL file, so therefore tackling one thing at a time. Also, there were no answers that were coming up in the .database group. On top of that: >Really? You can have shi

Re: Guidance on writing a top-like console

2009-02-27 Thread ntwrkd
Thanks. These are all great suggestions. On Fri, Feb 27, 2009 at 2:35 PM, Tim Chase wrote: >> I am interested in writing an application that functions like a Unix >> or Linux top in the way it displays data. >> It should be command-line based but dynamically refreshing. > > You might look at the

Re: Guidance on writing a top-like console

2009-02-27 Thread Tim Chase
I am interested in writing an application that functions like a Unix or Linux top in the way it displays data. It should be command-line based but dynamically refreshing. You might look at the sourcecode for "iotop"[1] which would make a good example (it's a "top"-like program written in Python

Re: Guidance on writing a top-like console

2009-02-27 Thread Mike Driscoll
On Feb 27, 4:08 pm, ntwrkd wrote: > I am interested in writing an application that functions like a Unix > or Linux top in the way it displays data. > It should be command-line based but dynamically refreshing. > > I'm not sure what I should take into account or how I might go about > implementing

Re: Guidance on writing a top-like console

2009-02-27 Thread Paul Rubin
ntwrkd writes: > I'm not sure what I should take into account or how I might go about > implementing this? Maybe the curses module. http://docs.python.org/library/curses.html -- http://mail.python.org/mailman/listinfo/python-list

Re: removing duplication from a huge list.

2009-02-27 Thread Paul Rubin
Tim Rowe writes: > We were told in the original question: more than 15 million records, > and it won't all fit into memory. So your observation is pertinent. That is not terribly many records by today's standards. The knee-jerk approach is to sort them externally, then make a linear pass skippin

Guidance on writing a top-like console

2009-02-27 Thread ntwrkd
I am interested in writing an application that functions like a Unix or Linux top in the way it displays data. It should be command-line based but dynamically refreshing. I'm not sure what I should take into account or how I might go about implementing this? Any suggestions are appreciated. -- htt

Re: Define a constant in Python C extension

2009-02-27 Thread Mel
fredbasset1...@gmail.com wrote: > I'm writing a C extension for Python, is it possible to define > constants in the C code and have them visible from Python? There's an API function to create a module-level name with a given value, e.g. PyModule_AddIntConstant (module, "S_IRUSR", S_IRUSR); //

Re: Define a constant in Python C extension

2009-02-27 Thread Robert Kern
On 2009-02-27 14:54, fredbasset1...@gmail.com wrote: I'm writing a C extension for Python, is it possible to define constants in the C code and have them visible from Python? In your init function, create Python objects from the constants and insert them into the module using PyModule_AddObjec

Define a constant in Python C extension

2009-02-27 Thread fredbasset1000
I'm writing a C extension for Python, is it possible to define constants in the C code and have them visible from Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: removing duplication from a huge list.

2009-02-27 Thread Steve Holden
Falcolas wrote: > On Feb 27, 10:07 am, Steve Holden wrote: >> Assuming no duplicates, how does this help? You still have to verify >> collisions. > > Absolutely. But a decent hashing function (particularly since you know > quite a bit about the data beforehand) will have very few collisions > (th

Re: Data Coding suggestions

2009-02-27 Thread Rick Dooling
On Feb 27, 6:42 am, "steven.oldner" wrote: > Just learning Python and have a project to create a weekly menu and a > shopping list from the menu.   > Question:  How should I set up the data?  I'm looking at maybe 70 menu > items and maybe 1000 items for the shopping list.  I need to be able > to

Re: removing duplication from a huge list.

2009-02-27 Thread Falcolas
On Feb 27, 10:07 am, Steve Holden wrote: > Assuming no duplicates, how does this help? You still have to verify > collisions. Absolutely. But a decent hashing function (particularly since you know quite a bit about the data beforehand) will have very few collisions (theoretically no collisions, a

Re: Using xreadlines

2009-02-27 Thread Roy H. Han
On Fri, Feb 27, 2009 at 12:20 PM, Scott David Daniels wrote: > (1) Please do not top post in comp.lang.python, it violates conventions. > > Brett Hedges (should have written): >> bearophile wrote: ... >>> >>> You can also keep track of the absolute position of the lines in the >>> file, etc, or st

Re: TextCtrl fully expanding at program start

2009-02-27 Thread alex
On 27 Feb., 15:14, Vlastimil Brom wrote: > 2009/2/27 alex : > > > Hi all > > I have a gridsizer consisting of two vertically stacked panels, one > > with a StaticBox and the other with a TextCtrl. > > I would like that the TextCtrl expands at program start fully to the > > allocated panel size (lo

Re: starting a Python 2.5 executable without the DOS window

2009-02-27 Thread Daniel
On Feb 27, 8:19 am, Vlastimil Brom wrote: > >> 2009/2/27 Greg Miller : > >> > I am working on a program that controls a piece of equipment.  The GUI/ > >> > control software is written with Python2.5/wxPython.  I would like to > >> > know if there is a way of starting the GUI without the DOS windo

Re: removing duplication from a huge list.

2009-02-27 Thread Tim Rowe
2009/2/27 Steve Holden : > Assuming no duplicates, how does this help? You still have to verify > collisions. > >> Pretty brutish and slow, but it's the first algorithm which comes to >> mind. Of course, I'm assuming that the list items are long enough to >> warrant using a hash and not the values

Marching Cubes example

2009-02-27 Thread PhilC
Does anyone know of sample code showing how the marching cubes algorithm may be implimented using Python? Ref:- http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/ I can set up the cubes and test to see if their vertices are inside the isosurface. I can produce a resulting "metaball" but

Re: removing duplication from a huge list.

2009-02-27 Thread Tim Chase
How big of a list are we talking about? If the list is so big that the entire list cannot fit in memory at the same time this approach wont work e.g. removing duplicate lines from a very large file. We were told in the original question: more than 15 million records, and it won't all fit into me

Re: Run a python script as an exe and run a new process from it

2009-02-27 Thread Paddy O'Loughlin
2009/2/27 venutaurus...@gmail.com : > Thanks for the reply,, >            I am trying to use the above application using psexec()in > command line.But it failed returning the error message > >  exited with error code 255. > >              But when I ran the application normally it worked > fine.Do

Re: Using xreadlines

2009-02-27 Thread Scott David Daniels
(1) Please do not top post in comp.lang.python, it violates conventions. Brett Hedges (should have written): > bearophile wrote: ... You can also keep track of the absolute position of the lines in the file, etc, or step >> back looking for newlines, etc, but it's not handy How would I ke

Re: removing duplication from a huge list.

2009-02-27 Thread Steve Holden
Falcolas wrote: > On Feb 27, 8:33 am, Tim Rowe wrote: >> 2009/2/27 odeits : >> >>> How big of a list are we talking about? If the list is so big that the >>> entire list cannot fit in memory at the same time this approach wont >>> work e.g. removing duplicate lines from a very large file. >> We we

Re: Using xreadlines

2009-02-27 Thread Roy H. Han
Brett, I'm not sure what exactly you're trying to do, but you can keep track of line numbers using itertools. import itertools for lineIndex, line in itertools.izip(itertools.count(1), open('text.txt')): print lineIndex, line Here is sample code for breaking on a word and returning the prev

Re: What functions, other than sleep(), can be interrupted by Ctrl-C?

2009-02-27 Thread Maxim Khitrov
On Thu, Feb 26, 2009 at 3:47 PM, Gabriel Genellina wrote: >> I'm looking for a function in the standard library or pywin32 package >> that will block until a certain condition is met or it is interrupted >> by Ctrl-C. For example, time.sleep() would have been perfect for my >> needs if thread.inte

Re: removing duplication from a huge list.

2009-02-27 Thread Falcolas
On Feb 27, 8:33 am, Tim Rowe wrote: > 2009/2/27 odeits : > > > How big of a list are we talking about? If the list is so big that the > > entire list cannot fit in memory at the same time this approach wont > > work e.g. removing duplicate lines from a very large file. > > We were told in the orig

Re: Using xreadlines

2009-02-27 Thread bearophileHUGS
Brett Hedges: > How would I keep track of the absolute position of the lines? You may have to do all things manually (tell, seek and looking for newlines manually, iterating chars), that's why I have said it's not handy. The other solutions are simpler. Bye, bearophile -- http://mail.python.org/m

Re: Make a python property with the same name as the class member name

2009-02-27 Thread Chris Rebert
On Fri, Feb 27, 2009 at 5:59 AM, Ravi wrote: > Is it possible in python to create a property with the same name as > the member variable name of the class. e.g. No, because accessing the property and the instance variable are *syntactically identical* (it's the raison detre of properties) so ther

Re: Using xreadlines

2009-02-27 Thread Brett Hedges
> You can also keep track of the absolute position of the lines in the file, > etc, or step back looking for newlines, etc, but it's not handy. How would I keep track of the absolute position of the lines? I have tried to use the files.seek() command with the files.tell() command and it does n

Re: How to parse form in client side?

2009-02-27 Thread Stefan Behnel
Muddy Coder wrote: > cgi module can easily acquire the all fields of data input from client > side, through a form. Then, a simple line of code: > > form_dict = cgi.FieldStorage() > > grabs all data into a dictionary form_dict. The rest becomes a piece > of cake by querying the form_dict. Nice! >

Re: ANN: updates to Python-by-example

2009-02-27 Thread steven.oldner
On Feb 27, 8:40 am, pyt...@bdurham.com wrote: > Rainy, > > Great stuff! Thanks for your examples with the community!! > > Regards, > Malcolm Let me add my thanks! I using it now... -- http://mail.python.org/mailman/listinfo/python-list

Re: removing duplication from a huge list.

2009-02-27 Thread Tim Rowe
2009/2/27 odeits : > How big of a list are we talking about? If the list is so big that the > entire list cannot fit in memory at the same time this approach wont > work e.g. removing duplicate lines from a very large file. We were told in the original question: more than 15 million records, and

Re: Proposed implementation for an Ordered Dictionary

2009-02-27 Thread bearophileHUGS
Steve Holden: > A sort of premature pessimization, then. Maybe not, the save in memory may lead to higher speed anyway. So you need to test it to know the overall balance. And in data structures with general purpose you want all the speed you can get. Bye, bearophile -- http://mail.python.org/mai

RE: Capture Keystrokes from a USB Wireless Keyboard.

2009-02-27 Thread Support Desk
Thanks, I'm looking for something I can integrate into a simple game I'm working on that will run in Linux. -Original Message- From: Shane Geiger [mailto:sgei...@councilforeconed.org] Sent: Friday, February 27, 2009 9:09 AM To: Support Desk Cc: python-list@python.org Subject: Re: Capture

Re: starting a Python 2.5 executable without the DOS window

2009-02-27 Thread Vlastimil Brom
>> 2009/2/27 Greg Miller : >> > I am working on a program that controls a piece of equipment.  The GUI/ >> > control software is written with Python2.5/wxPython.  I would like to >> > know if there is a way of starting the GUI without the DOS window >> > having to launch?  I would like only the app

Re: Capture Keystrokes from a USB Wireless Keyboard.

2009-02-27 Thread Shane Geiger
Here's one option: http://pykeylogger.sourceforge.net/wiki/index.php/PyKeylogger:FAQ Support Desk wrote: Does anybody know of a way to capture keystrokes form a wireless USB keyboard using python? -- http://

Capture Keystrokes from a USB Wireless Keyboard.

2009-02-27 Thread Support Desk
Does anybody know of a way to capture keystrokes form a wireless USB keyboard using python? -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I know when a sub-process is effectively initialized?

2009-02-27 Thread Tim Golden
Giampaolo Rodola' wrote: It seems to work fine on posix but we still got problems on Windows where it seems that waiting for pid to show up in the system process list is not enough for considering the process effectively initialized. Anyway, I think it's a problem in our code. Thanks for your hel

Re: How can I know when a sub-process is effectively initialized?

2009-02-27 Thread Giampaolo Rodola'
On 26 Feb, 21:59, Jean-Paul Calderone wrote: > On Thu, 26 Feb 2009 12:27:26 -0800 (PST), Giampaolo Rodola' > wrote: > >Hi, > >I'm working on a Python module called psutil [1] for reading process > >information in a cross-platform way. > >I'm having a problem with psutil test suite. > >Almost all

Re: ANN: updates to Python-by-example

2009-02-27 Thread python
Rainy, Great stuff! Thanks for your examples with the community!! Regards, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: starting a Python 2.5 executable without the DOS window

2009-02-27 Thread Ulrich Eckhardt
Greg Miller wrote: > I would like to know if there is a way of starting the GUI > without the DOS window having to launch? Use pythonw.exe instead of python.exe. Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinf

Re: starting a Python 2.5 executable without the DOS window

2009-02-27 Thread pruebauno
On Feb 27, 9:12 am, Greg Miller wrote: > I am working on a program that controls a piece of equipment.  The GUI/ > control software is written with Python2.5/wxPython.  I would like to > know if there is a way of starting the GUI without the DOS window > having to launch?  I would like only the ap

starting a Python 2.5 executable without the DOS window

2009-02-27 Thread Greg Miller
I am working on a program that controls a piece of equipment. The GUI/ control software is written with Python2.5/wxPython. I would like to know if there is a way of starting the GUI without the DOS window having to launch? I would like only the application itself to appear, no DOS window. Than

Re: TextCtrl fully expanding at program start

2009-02-27 Thread Vlastimil Brom
2009/2/27 alex : > Hi all > I have a gridsizer consisting of two vertically stacked panels, one > with a StaticBox and the other with a TextCtrl. > I would like that the TextCtrl expands at program start fully to the > allocated panel size (lower panel of gridSizer). > Instead of like now, fully ex

Re: OT: handling multiple software repositories

2009-02-27 Thread Tim Golden
Loretta SALINO wrote: Tim Golden wrote: Thomas Guettler wrote: Hi, this is a bit off topic. In our company we have several SVN repositories. According to [1] Trac by default only handles one repository. Of course Trac links like changeset [1234] would not work anymore. You would need [repr

Make a python property with the same name as the class member name

2009-02-27 Thread Ravi
Is it possible in python to create a property with the same name as the member variable name of the class. e.g. Class X: ... self.i = 10 # marker ... property(fget = get_i, fset = set_i) Please tell me how I can do so. Because if I do so, for the statement at marker I get stack ov

ANN: updates to Python-by-example

2009-02-27 Thread Rainy
Python-by-example http://pbe.lightbird.net/index.html";>http:// pbe.lightbird.net has some new modules added: pickle, shelve, sqlite3, gzip, csv, configparser, optparse, logging. I also changed over to using excellent sphinx package to generate documentation, this will allow me to add pdf and windo

Re: OT: handling multiple software repositories

2009-02-27 Thread Loretta SALINO
Tim Golden wrote: > Thomas Guettler wrote: >> Hi, >> >> this is a bit off topic. >> >> In our company we have several SVN repositories. >> >> According to [1] Trac by default only handles one >> repository. >> >> Of course Trac links like changeset [1234] would not work anymore. >> You would n

Re: Delete all items in the list

2009-02-27 Thread Chris Rebert
On Fri, Feb 27, 2009 at 5:10 AM, Steve Holden wrote: > Chris Rebert wrote: >> On Thu, Feb 26, 2009 at 10:26 PM, odeits wrote: > [...] >>> while 'a' in L: >>>   L.remove('a') >>> >>> not the most efficient but it works >> >> "Not the most efficient"; it's terribly inefficient! It's 2*O(M*N) [M >>

Re: Data Coding suggestions

2009-02-27 Thread Steve Holden
steven.oldner wrote: > Just learning Python and have a project to create a weekly menu and a > shopping list from the menu. This is something I do manually now, so > I'm automating it. > > What I'd like is a list of menu choices, such as: > CODE- Description - Est Cost > > 'B01 - Pancakes, Saus

Re: Multiple conditional expression

2009-02-27 Thread Steve Holden
Anjanesh Lekshminarayanan wrote: >> How do we know that from the what the OP posted? > Its CGI alright. > spaces = form.has_key('spaces') and form.getvalue('spaces') == '1' > > But I just dont see how > spaces = (form.has_key('spaces') ? form.getvalue('spaces') == 1 ? > True: False : False) > is c

Re: Delete all items in the list

2009-02-27 Thread Steve Holden
Chris Rebert wrote: > On Thu, Feb 26, 2009 at 10:26 PM, odeits wrote: [...] >> while 'a' in L: >> L.remove('a') >> >> not the most efficient but it works > > "Not the most efficient"; it's terribly inefficient! It's 2*O(M*N) [M > = number of 'a's in L], versus just N. And that's not even accoun

Re: problem with glob in remote directory or os.walk in remote directory in windos

2009-02-27 Thread Steve Holden
lameck kassana wrote: > At last i did it it was this wrong line file_count += len(files) ---it > supposed to be file_count+=1 > but thanks for help ya python masters .Steven Holden thanks very > very much for your tip about raw string > Lameck: Please note that file_count = 0 for files in

Re: Proposed implementation for an Ordered Dictionary

2009-02-27 Thread Steve Holden
bearophileh...@lycos.com wrote: > Paul Rubin: >> I don't see how to delete a randomly chosen node if you use that trick, >> since the hash lookup doesn't give you two consecutive nodes in the linked >> list to xor together.< > > Thank you, I think you are right, I am sorry. > So on 32-bit CPUs y

Re: Queries

2009-02-27 Thread Steve Holden
Dennis Lee Bieber wrote: [...] > {Oh, and since I saw, at work, a later post with a bunch of nested UNION > statements: UNION requires all the tables to have the same number/type > of columns -- you don't have that} A rather fine point, but technically all that's required is the the united *querie

Re: struct.unpack() on a stream

2009-02-27 Thread Gabriel Genellina
En Fri, 27 Feb 2009 10:10:39 -0200, MRAB escribió: Gabriel Genellina wrote: En Fri, 27 Feb 2009 09:29:16 -0200, Ulrich Eckhardt escribió: I have a socket from which I would like to parse some data, how would I do that? Of course, I can manually read data from the socket until unpack(

Re: removing duplication from a huge list.

2009-02-27 Thread odeits
On Feb 27, 1:18 am, Stefan Behnel wrote: > bearophileh...@lycos.com wrote: > > odeits: > >> How big of a list are we talking about? If the list is so big that the > >> entire list cannot fit in memory at the same time this approach wont > >> work e.g. removing duplicate lines from a very large fil

TextCtrl fully expanding at program start

2009-02-27 Thread alex
Hi all I have a gridsizer consisting of two vertically stacked panels, one with a StaticBox and the other with a TextCtrl. I would like that the TextCtrl expands at program start fully to the allocated panel size (lower panel of gridSizer). Instead of like now, fully expanding in the width but not

Data Coding suggestions

2009-02-27 Thread steven.oldner
Just learning Python and have a project to create a weekly menu and a shopping list from the menu. This is something I do manually now, so I'm automating it. What I'd like is a list of menu choices, such as: CODE- Description - Est Cost 'B01 - Pancakes, Sausage,and Eggs - $5.80, 'L01 - Tuna Fis

Re: problem with glob in remote directory or os.walk in remote directory in windos

2009-02-27 Thread Steve Holden
lameck kassana wrote: > now it is working but i wonder it brings higher number of count as if it > counts files in wholes computer can you check in my code and correct me > > import glob > import os > file_count=0 > for files in glob.glob(r"\\192.16

Re: struct.unpack() on a stream

2009-02-27 Thread MRAB
Gabriel Genellina wrote: En Fri, 27 Feb 2009 09:29:16 -0200, Ulrich Eckhardt escribió: I have a socket from which I would like to parse some data, how would I do that? Of course, I can manually read data from the socket until unpack() stops complaining about a lack of data, but that sounds r

Re: struct.unpack() on a stream

2009-02-27 Thread Gabriel Genellina
En Fri, 27 Feb 2009 09:29:16 -0200, Ulrich Eckhardt escribió: I have a socket from which I would like to parse some data, how would I do that? Of course, I can manually read data from the socket until unpack() stops complaining about a lack of data, but that sounds rather inelegant. Any be

Re: String search

2009-02-27 Thread odeits
On Feb 27, 2:17 am, "Gabriel Genellina" wrote: > En Fri, 27 Feb 2009 07:33:44 -0200, pranav escribió: > > > Greeting fellow pycoders, > > > I have a script that browses large codes and replaces certain text > > with some other text. Of lately i observed an issue.Some of the > > original text were

struct.unpack() on a stream

2009-02-27 Thread Ulrich Eckhardt
Hi! I have a socket from which I would like to parse some data, how would I do that? Of course, I can manually read data from the socket until unpack() stops complaining about a lack of data, but that sounds rather inelegant. Any better suggestions? Uli -- Sator Laser GmbH Geschäftsführer: Tho

Re: factoring wx.Image

2009-02-27 Thread Gabriel Genellina
En Fri, 27 Feb 2009 00:06:47 -0200, Astan Chee escribió: I want to factor (red, green and blue at the same time) an image using wx but without any GUI display or windows but it keeps crashing What do you mean? Really crashing? Or do you get a Python stack trace? and if I set the checks to i

Re: Proposed implementation for an Ordered Dictionary

2009-02-27 Thread bearophileHUGS
Paul Rubin: >I don't see how to delete a randomly chosen node if you use that trick, since >the hash lookup doesn't give you two consecutive nodes in the linked list to >xor together.< Thank you, I think you are right, I am sorry. So on 32-bit CPUs you need to add 8 bytes to each value. On 64-b

Re: String search

2009-02-27 Thread Gabriel Genellina
En Fri, 27 Feb 2009 07:33:44 -0200, pranav escribió: Greeting fellow pycoders, I have a script that browses large codes and replaces certain text with some other text. Of lately i observed an issue.Some of the original text were like ,N'#attributes.SOFTPREREQ#' My module does scan this

Re: problem with glob in remote directory or os.walk in remote directory in windos

2009-02-27 Thread lameck kassana
At last i did it it was this wrong line file_count += len(files) ---it supposed to be file_count+=1 but thanks for help ya python masters .Steven Holden thanks very very much for your tip about raw string On Fri, Feb 27, 2009 at 12:43 PM, Gabriel Genellina wrote: > En Fri, 27 Feb 2009 07:02

Re: String search

2009-02-27 Thread Bruno Desthuilliers
pranav a écrit : Greeting fellow pycoders, I have a script that browses large codes and replaces certain text with some other text. Of lately i observed an issue.Some of the original text were like ,N'#attributes.SOFTPREREQ#' My module does scan this code and suggests replacement to this

Re: decimal to string conv

2009-02-27 Thread Aj
On Feb 27, 10:58 am, Chris Rebert wrote: > On Fri, Feb 27, 2009 at 1:45 AM, Aj wrote: > > Hi all, > > > I am trying to convert a list to string. > > example [80, 89,84,72,79,78,0] is my input. I could make it to just > > [0x50,0x59,0x54,0x48,0x4F,0x4E,0x00]. > > but I wanted it to be like "PYTHON

Re: decimal to string conv

2009-02-27 Thread Chris Rebert
On Fri, Feb 27, 2009 at 1:45 AM, Aj wrote: > Hi all, > > I am trying to convert a list to string. > example [80, 89,84,72,79,78,0] is my input. I could make it to just > [0x50,0x59,0x54,0x48,0x4F,0x4E,0x00]. > but I wanted it to be like "PYTHON". > I couldnt even convert 0x50 to 'P'. Is there any

decimal to string conv

2009-02-27 Thread Aj
Hi all, I am trying to convert a list to string. example [80, 89,84,72,79,78,0] is my input. I could make it to just [0x50,0x59,0x54,0x48,0x4F,0x4E,0x00]. but I wanted it to be like "PYTHON". I couldnt even convert 0x50 to 'P'. Is there any library api available to do this? it will be really helpf

Microsoft Message Queues

2009-02-27 Thread CinnamonDonkey
Hi All, I am looking to use win32com to set-up a Microsoft Message Queue (MSMQ) between two or more computers connected on a LAN. I have found this posting: http://groups.google.co.uk/group/comp.lang.python/browse_thread/thread/80b42375ae84e3d7/989b864575997a9e?hl=en&lnk=gst&q=msmq#989b864575997

Re: problem with glob in remote directory or os.walk in remote directory in windos

2009-02-27 Thread Gabriel Genellina
En Fri, 27 Feb 2009 07:02:57 -0200, lameck kassana escribió: now it is working but i wonder it brings higher number of count as if it counts files in wholes computer can you check in my code and correct me import glob import os file_count=0 fo

String search

2009-02-27 Thread pranav
Greeting fellow pycoders, I have a script that browses large codes and replaces certain text with some other text. Of lately i observed an issue.Some of the original text were like ,N'#attributes.SOFTPREREQ#' My module does scan this code and suggests replacement to this code. But when i u

Re: What functions, other than sleep(), can be interrupted by Ctrl-C?

2009-02-27 Thread James Matthews
You can hook the it on the main thread and just pass it. And let the threads execute. On Thu, Feb 26, 2009 at 10:47 PM, Gabriel Genellina wrote: > En Thu, 26 Feb 2009 16:17:42 -0200, Maxim Khitrov > escribió: > > > I'm looking for a function in the standard library or pywin32 package >> that wi

Re: removing duplication from a huge list.

2009-02-27 Thread Stefan Behnel
bearophileh...@lycos.com wrote: > odeits: >> How big of a list are we talking about? If the list is so big that the >> entire list cannot fit in memory at the same time this approach wont >> work e.g. removing duplicate lines from a very large file. > > If the data are lines of a file, and keeping

Re: Proposed implementation for an Ordered Dictionary

2009-02-27 Thread Paul Rubin
bearophileh...@lycos.com writes: > So using the XOR (or subtraction) trick to use only 1 pointer for > each key-value may be useful to keep performance not too much far > from the normal python dicts: http://en.wikipedia.org/wiki/XOR_linked_list I don't see how to delete a randomly chosen node if

Re: problem with glob in remote directory or os.walk in remote directory in windos

2009-02-27 Thread lameck kassana
now it is working but i wonder it brings higher number of count as if it counts files in wholes computer can you check in my code and correct me import glob import os file_count=0 for files in glob.glob(r"\\192.168.0.45\loader\Files\file_log\v20090

Re: removing duplication from a huge list.

2009-02-27 Thread bearophileHUGS
odeits: > How big of a list are we talking about? If the list is so big that the > entire list cannot fit in memory at the same time this approach wont > work e.g. removing duplicate lines from a very large file. If the data are lines of a file, and keeping the original order isn't important, then

Re: Multiple conditional expression

2009-02-27 Thread bearophileHUGS
Chris Rebert: > That seems to just be an overly complicated way of writing: > > spaces = bool(form.has_key('spaces') and form.getvalue('spaces') == 1) Better: spaces = bool(('spaces' in form) and form.getvalue('spaces') == 1) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposed implementation for an Ordered Dictionary

2009-02-27 Thread bearophileHUGS
Raymond Hettinger: >Paul Rubin: >>another (messy) approach would be to write a C >>extension that uses a doubly linked list some day. > > That seems like an ideal implementation to me. This was my Python implementation, where the delete too is O(1), but it's slow: http://code.activestate.com/recip

Re: Can someone explain this behavior to me?

2009-02-27 Thread Jesse Aldridge
Ah, I get it. Thanks for clearing that up, guys. -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: handling multiple software repositories

2009-02-27 Thread Thomas Guettler
Luis Zarrabeitia schrieb: ... > It's quite good (and easy to install, unlike gforge), but the developers are > moving on to a version 2.0 that you can find around here: > > http://basieproject.org/ (yeah, the website is ugly). Is uses django. That's nice since I know it. But the page looks