Re: PYTHONPATH on Windows XP module load problem

2009-05-20 Thread Andreas Otto
Hi, I setup the PYTHONPATH environment variable too does windows use this variable ? mfg Andreas Otto -- http://mail.python.org/mailman/listinfo/python-list

Error in code send Email

2009-05-20 Thread Kalyan Chakravarthy
Hi All, import smtplib mail="a...@xyz.com"; subject="Hai"; msg = 'Some Text'; smtp_server = smtplib.SMTP( 'mail.%s' % mail.split( '@' )[-1] ) smtp_server.sendmail( mail , [ mail ] , 'Subject: %s\n' % subject + 'To: %s\n' % mail

Re: Yet another question about class property.

2009-05-20 Thread Dave Angel
Jim Qiu wrote: Thanks for you patience, Dave. Obviously i have not got used to the python philosophy. Following you guide, i implemented the following code, and you are absolutely right. #!/usr/bin/python #coding:utf-8 class Parent(object): def __init__(self): pass def displayAttrOfSubClass(

Re: Adding a Par construct to Python?

2009-05-20 Thread Carl Banks
I don't have any reply to this post except for the following excerpts: On May 20, 8:10 pm, Luis Alberto Zarrabeitia Gomez wrote: > 2- in [almost] every other language, _you_ have to be aware of the critical > sections when multithreading. [snip] > That's not what I said. We are not talking about

Re: LaTeXing python programs

2009-05-20 Thread Tim Arnold
"John Reid" wrote in message news:mailman.458.1242842132.8015.python-l...@python.org... > Edward Grefenstette wrote: >> I'm typing up my master's thesis and will be including some of the >> code used for my project in an appendix. The question is thus: is >> there a LaTeX package out there that

Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread Dave Angel
walterbyrd wrote: Example 5.6. Coding the FileInfo Class class FileInfo(UserDict): "store file metadata" def __init__(self, filename=ne): UserDict.__init__(self)(1) self["name"] =ilename(2) What I do not understand is the last line. I thought 'self' was

Re: P2P text chat engine

2009-05-20 Thread Daniel Fetchinson
>>> > If you have the source code of a p2p text chat engine please send to me >>> >>> I found that & a pot of gold under my bed. Care to give me your address >>> so that I can send it to you? >>> >>> SCNR, >>> Diez >> >> Hello, can you sent it to me ? >> ave...@gmail.com >> Many thanks!!! > > I nee

Re: Adding a Par construct to Python?

2009-05-20 Thread Luis Alberto Zarrabeitia Gomez
Quoting Carl Banks : > On May 20, 4:07 pm, Luis Zarrabeitia wrote: > > On Wednesday 20 May 2009 06:16:39 pm Aahz wrote: > > The designers of Python made a design decision(**) that extension > writers would not have to take care of locking. They could have made > a different decision, they just

Re: Wrapping methods of built-in dict

2009-05-20 Thread I V
On Thu, 21 May 2009 02:31:29 +, Steven D'Aprano wrote: > So the problem isn't directly with getmembers, but with the predicate > functions you have passed to it (inspect.isfunction and inspect.method). > Try inspect.ismethoddescriptor instead. Or perhaps callable ? callable({}.get) and callabl

Re: How to get Form values in Python code and Send Email

2009-05-20 Thread Mike Kazantsev
On Wed, 20 May 2009 17:49:47 +0530 Kalyan Chakravarthy wrote: > Hi > Now i can able to get the form details in to python code, > > can any one tell me the format to send form values to one Emil > id ... for this I required SMTP set up? You can use email and smtplib modules for that alon

Re: Wrapping methods of built-in dict

2009-05-20 Thread Steven D'Aprano
On Wed, 20 May 2009 18:42:38 -0700, shailesh wrote: > The reason as far as I understand is that the methods on the built-in > dict are not of MethodType or FunctionType That seems to be true: >>> type({}.get) >>> type(dict.get) > so they are not included in > the result of the inspect.getm

Re: u'\N{dollar sign}'

2009-05-20 Thread John Machin
On May 21, 11:14 am, belred wrote: > i can't for the life of me figure out where the unicode \N specifier > is located in the python documentation (2.6).  can anyone point me to > the page in the docs? http://docs.python.org/reference/lexical_analysis.html#string-literals -- http://mail.python.o

Wrapping methods of built-in dict

2009-05-20 Thread shailesh
Hello, I'm trying to write a class decorator which takes a function as an argument and wraps instancemethods of the class with the function. After reading a few examples on ActiveState and this blog post , my first attempt goes something like this: def tracing_wrapper(fn): import functools

Re: Adding a Par construct to Python?

2009-05-20 Thread Carl Banks
On May 20, 4:07 pm, Luis Zarrabeitia wrote: > On Wednesday 20 May 2009 06:16:39 pm Aahz wrote: > > > >While I agree that the GIL greatly simplifies things for the > > >interpreter, I don't understand this statement. In practice, you should > > >lock all critical sections if you expect your code to

Re: Yet another question about class property.

2009-05-20 Thread Jim Qiu
Thanks for you patience, Dave. Obviously i have not got used to the python philosophy. Following you guide, i implemented the following code, and you are absolutely right. #!/usr/bin/python #coding:utf-8 class Parent(object): def __init__(self): pass def displayAttrOfSubClass(self): print self

u'\N{dollar sign}'

2009-05-20 Thread belred
i can't for the life of me figure out where the unicode \N specifier is located in the python documentation (2.6). can anyone point me to the page in the docs? thanks, bryan -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE doesn't save preferences

2009-05-20 Thread Kevin Walzer
Kevin Walzer wrote: I'm using IDLE on Mac OS X 10.5.7 (Python 2.6.2) and I'm getting a strange error when I try to save preferences from the configuration dialog: Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/p

Re: reseting an iterator

2009-05-20 Thread Steven D'Aprano
On Wed, 20 May 2009 11:35:47 -0700, Jan wrote: > Wouldn't it be easy for Python to implement generating functions so that > the iterators they return are equipped with a __reset__() method? No. def gen(): for name in os.listdir('.'): yield open(name).read() os.remove(name)

Re: scoping problem with list comprehension // learning Python

2009-05-20 Thread Benjamin Peterson
Adrian Dragulescu eskimo.com> writes: > > > I just started to learn python (first posting to the list). > > I have a list of dates as strings that I want to convert to a > list of datetime objects. Here is my debugging session from inside a > method. > > (Pdb) formatIndex > '%Y-%m-%d' > (

Re: Import and absolute file names, sys.path including ''... or not

2009-05-20 Thread Mike Kazantsev
On Wed, 20 May 2009 22:01:50 +0200 Jean-Michel Pichavant wrote: > You are right, but my concern is not the relative path resolution. Let > me clarify: > > /home/jeanmichel/test.py: > "import sys > print sys.path" > > >python.exe test.py > sys.path = ['/home/jeanmichel'] > > from within a pyt

Python IDE PyScripter v1.9.9.7 released

2009-05-20 Thread PyScripter
PyScripter version 1.9.9.7 has been released at http://pyscripter.googlecode.com. PyScripter is a free and open-source Python Integrated Development Environment (IDE) created with the ambition to become competitive in functionality with commercial Windows-based IDEs available for other languages.

Pydev 1.4.6 Released

2009-05-20 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.4.6 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: ---

Re: from __future__ import absolute_import issue

2009-05-20 Thread LittleGrasshopper
On May 20, 4:18 pm, LittleGrasshopper wrote: > New to the group, this is my first post... > > It appears that either absolute imports (or my brain) aren't working. > Given a module string.py which is in the same directory as a.py: > > #File a.py > from __future__ import absolute_import > > import

IDLE doesn't save preferences

2009-05-20 Thread Kevin Walzer
I'm using IDLE on Mac OS X 10.5.7 (Python 2.6.2) and I'm getting a strange error when I try to save preferences from the configuration dialog: Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/lib-tk/Tkint

from __future__ import absolute_import issue

2009-05-20 Thread LittleGrasshopper
New to the group, this is my first post... It appears that either absolute imports (or my brain) aren't working. Given a module string.py which is in the same directory as a.py: #File a.py from __future__ import absolute_import import string print string # Module imported is string.py in curren

Re: Adding a Par construct to Python?

2009-05-20 Thread Luis Zarrabeitia
On Wednesday 20 May 2009 06:16:39 pm Aahz wrote: > >While I agree that the GIL greatly simplifies things for the > >interpreter, I don't understand this statement. In practice, you should > >lock all critical sections if you expect your code to be used in a > >multithreading environment.  That can'

Re: PYTHONPATH on Windows XP module load problem

2009-05-20 Thread Scott David Daniels
Andreas Otto wrote: I have done additional research. 1. setup a "setup.py" script 2. compiled the extension 3. copy the extension to the test directory -> cp ../pymsgque/build/lib.win32-3.0-pydebug/pymsgque.pyd . This doesn't work. Windows is beseiged by trojan writers.

Re: optparse question, passing unknown flags to subprocess

2009-05-20 Thread Robert Kern
On 2009-05-20 16:50, Joseph Garvin wrote: I'm working on a python script that takes several command line flags, currently parsed by hand. I'd like to change the script to parse them with OptionParser from the optparse module. However, currently the script invokes a subprocess, and any flags the s

Re: LaTeXing python programs

2009-05-20 Thread Edward Grefenstette
On May 20, 10:10 pm, John Reid wrote: > Alan G Isaac wrote: > > The listings package is great and highly configurable. > > Note that you can also input entire files of Python code > > or pieces of them based on markers.  Really quite great. > > I tried listings. I believe pygments makes better for

Re: Adding a Par construct to Python?

2009-05-20 Thread Aahz
In article , Luis Zarrabeitia wrote: >On Monday 18 May 2009 10:31:06 pm Carl Banks wrote: >> >> Even if you decided to accept the penalty and add locking to >> refcounts, you still have to be prepared for context switching at any >> time when writing C code, which means in practice you have to lo

Re: Performance java vs. python

2009-05-20 Thread Aahz
In article , namekuseijin wrote: > >I find it completely unimaginable that people would even think >suggesting the idea that Java is simpler. It's one of the most stupidly >verbose and cranky languages out there, to the point you can't really do >anything of relevance without an IDE automatic

scoping problem with list comprehension // learning Python

2009-05-20 Thread Adrian Dragulescu
I just started to learn python (first posting to the list). I have a list of dates as strings that I want to convert to a list of datetime objects. Here is my debugging session from inside a method. (Pdb) formatIndex '%Y-%m-%d' (Pdb) [datetime.strptime(i, formatIndex) for i in self.index[0

optparse question, passing unknown flags to subprocess

2009-05-20 Thread Joseph Garvin
I'm working on a python script that takes several command line flags, currently parsed by hand. I'd like to change the script to parse them with OptionParser from the optparse module. However, currently the script invokes a subprocess, and any flags the script doesn't understand it assumes are mean

Re: Adding a Par construct to Python?

2009-05-20 Thread Luis Zarrabeitia
On Wednesday 20 May 2009 04:32:59 pm Carl Banks wrote: > I wasn't really arguing that locking individual objects was a > significant penalty in computer time, only in programmer time.  The > locks on reference counts are what's expensive. > > Also, I'm not using it as an argument against removing t

Re: URGENT! Changing IE PAC Settings with Python

2009-05-20 Thread James Matthews
HI forwarded it to the Python Win32 list On Thu, May 21, 2009 at 12:11 AM, Tim Golden wrote: > K-Dawg wrote: > >> Thanks for any response. I am in a crisis where one of our networking >> guys >> moved where our PAC file is housed. There was a group policy set in >> Active >> Directory that set

Re: URGENT! Changing IE PAC Settings with Python

2009-05-20 Thread Tim Golden
K-Dawg wrote: Thanks for any response. I am in a crisis where one of our networking guys moved where our PAC file is housed. There was a group policy set in Active Directory that set the PAC file location in Internet Explorer to the new location. However, we have 100 remote centers that have a

Re: LaTeXing python programs

2009-05-20 Thread John Reid
Alan G Isaac wrote: The listings package is great and highly configurable. Note that you can also input entire files of Python code or pieces of them based on markers. Really quite great. I tried listings. I believe pygments makes better formatted output (at least out of the box). -- http:

Streaming pdf with URLLib

2009-05-20 Thread Scooter
I'm playing around with urllib, and httplib, trying to make something of a pdf proxy.I have a pdf that lives on an internal web server, and I would like to be able to stream it to my external server. (this is just a test for a bigger process. Yes I could just copy the pdf to the external box). I wa

Re: reseting an iterator

2009-05-20 Thread Terry Reedy
Jan wrote: Wouldn't it be easy for Python to implement generating functions so that the iterators they return are equipped with a __reset__() method? No. Such a method would have to poke around in the internals of the __next__ function in implementation specific ways. The values used to ini

Re: Adding a Par construct to Python?

2009-05-20 Thread Carl Banks
On May 20, 8:59 am, Luis Zarrabeitia wrote: > On Monday 18 May 2009 10:31:06 pm Carl Banks wrote: > > > Even if you decided to accept the penalty and add locking to > > refcounts, you still have to be prepared for context switching at any > > time when writing C code, which means in practice you h

Re: Seeking old post on developers who like IDEs vs developers who like simple languages

2009-05-20 Thread Steve Ferg
> I think you mean this clbuttic post: > http://osteele.com/archives/2004/11/ides That's it! Thanks very much, Marco!! It is good to read it again. It is like visiting a place where you grew up years ago, and finding that it is completely different than the way you remember it. It is surprisin

Re: P2P text chat engine

2009-05-20 Thread Diez B. Roggisch
Kirill wrote: > On 7 май, 21:23, "Diez B. Roggisch" wrote: >> Navanjo schrieb: >> >> > If you have the source code of a p2p text chat engine please send to me >> >> I found that & a pot of gold under my bed. Care to give me your address >> so that I can send it to you? >> >> SCNR, >> Diez > > He

URGENT! Changing IE PAC Settings with Python

2009-05-20 Thread K-Dawg
Hello, Thanks for any response. I am in a crisis where one of our networking guys moved where our PAC file is housed. There was a group policy set in Active Directory that set the PAC file location in Internet Explorer to the new location. However, we have 100 remote centers that have about 3 t

Re: Performance java vs. python

2009-05-20 Thread namekuseijin
Ant escreveu: # Python fh = open("myfile.txt") for line in fh: print line // Java ... BufferedReader reader = new BufferedReader(new FileReader ("myfile.txt")); String line = reader.readLine(); while (line != null) { System.out.println(line); } ... And that's without all of the clas

Re: Import and absolute file names, sys.path including ''... or not

2009-05-20 Thread Jean-Michel Pichavant
You are right, but my concern is not the relative path resolution. Let me clarify: /home/jeanmichel/test.py: "import sys print sys.path" >python.exe test.py sys.path = ['/home/jeanmichel'] > from within a python shell: sys.path = [''] The unpredictable effect of '' (at least something I did no

Re: Performance java vs. python

2009-05-20 Thread Ant
On May 20, 6:46 pm, namekuseijin wrote: > anyway, again, thanks for the laughs. I'm a Java developer in my day job, and I use Jython for testing out ideas and prototyping, due to the way Jython makes writing Java so much easier... Those examples were spot on - things weren't much simpler before g

Re: reseting an iterator

2009-05-20 Thread Alan G Isaac
Jan wrote: Wouldn't it be easy for Python to implement generating functions so that the iterators they return are equipped with a __reset__() method? Use ``send``: http://docs.python.org/whatsnew/2.5.html#pep-342-new-generator-features Remember, there may be no underlying sequence object for a

Re: LaTeXing python programs

2009-05-20 Thread Alan G Isaac
On Wednesday 20 May 2009 18:43:21 Edward Grefenstette wrote: is there a LaTeX package out there that works well for presenting python code? José Matos wrote: Use the listings package. It has a python as one of defined languages and has lots of other options. http://www.ctan.org/tex-archive/

Re: 2d barcode library?

2009-05-20 Thread Alan G Isaac
Christian Heimes wrote: https://cybernetics.hudora.biz/projects/wiki/huBarcode Cool. I have to mention a pure PostScript writer as well: http://www.terryburton.co.uk/barcodewriter/ Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: reseting an iterator

2009-05-20 Thread Jan
On May 20, 2:48 pm, Jan wrote: Iterators can also be produced by iter(ITERABLE) which could mnufacture them with a __reset__. Jan -- http://mail.python.org/mailman/listinfo/python-list

Re: Import and absolute file names, sys.path including ''... or not

2009-05-20 Thread Aahz
In article , Jean-Michel Pichavant wrote: > >I spent quite a time on a malicious issue. I found out that there is a >slight difference on the sys.path content when either executing code >from a shell or from within a script. This difference is the '' item, >which is present in the shell form of

Re: reseting an iterator

2009-05-20 Thread Jan
On May 20, 2:35 pm, Jan wrote: OOPS, I have pressed some keys and the message went out before It was finished. Here is the last fragment: So, one can define iterators by defining a class whose objects have methods __iter__ and __next__ -- with this approach it is easy to add some __reset__ metho

Re: LaTeXing python programs

2009-05-20 Thread José Matos
On Wednesday 20 May 2009 18:43:21 Edward Grefenstette wrote: > Yes, I am aware that this is more of a LaTeX question than a python > question, but I thought users here might be most likely to offer a > suitable recommendation. > > I'm typing up my master's thesis and will be including some of the

reseting an iterator

2009-05-20 Thread Jan
Wouldn't it be easy for Python to implement generating functions so that the iterators they return are equipped with a __reset__() method? Here is the context of this question. Python documentation defines a "iterator" as an object ITERATOR having methods __next__() and __iter__() such that the

Re: popen - reading strings - constructing a list from the strings

2009-05-20 Thread MRAB
Aytekin Vargun wrote: First of all, Thanks for the suggestions, MRAB and norseman. "split()" was what I was looking for. Now I have a follow up question. In my application I create radio buttons in a frame. These radio buttons are constructed whenever a button is clicked. Therefore the list of

Re: When does the escape character work within raw strings?

2009-05-20 Thread MRAB
walterbyrd wrote: I know that s = r'x\nx' means 'x' followed by a literal '\' followed by an 'n' (the '\n' is not a carriage return). s = r'x\tx' means 'x' followed by a literal '\' followed by an 't' (the '\t' is not a tab). But, boundries seem to work differently. s = re.sub(r'\bxxx\b', '

Re: LaTeXing python programs

2009-05-20 Thread John Reid
Edward Grefenstette wrote: I'm typing up my master's thesis and will be including some of the code used for my project in an appendix. The question is thus: is there a LaTeX package out there that works well for presenting python code? verbatim is a bit ugly and doesn't wrap code, and while the

Re: popen - reading strings - constructing a list from the strings

2009-05-20 Thread Aytekin Vargun
First of all, Thanks for the suggestions, MRAB and norseman. "split()" was what I was looking for. Now I have a follow up question. In my application I create radio buttons in a frame. These radio buttons are constructed whenever a button is clicked. Therefore the list of items are dynamically chan

Re: finding repeated data sequences in a column

2009-05-20 Thread norseman
r lines to test. marking already knowns eliminates redundant sequence testing. By subseting on pass1 the expensive testing is greatly reduced. If you know your subset data won't exceed memory then the "outfile" can be held in memory to speed things up considerably. Today is: 2

Re: Performance java vs. python

2009-05-20 Thread namekuseijin
On Tue, May 19, 2009 at 7:21 PM, David Stanek wrote: > On Tue, May 19, 2009 at 5:43 PM, namekuseijin wrote: >> someone said: >> >> If you took a look at Java, you would >> notice that the core language syntax is much simpler than Python's. >> >> thanks for the laughs whoever you are!

LaTeXing python programs

2009-05-20 Thread Edward Grefenstette
Yes, I am aware that this is more of a LaTeX question than a python question, but I thought users here might be most likely to offer a suitable recommendation. I'm typing up my master's thesis and will be including some of the code used for my project in an appendix. The question is thus: is ther

Ann: Nucular full text search 0.5 +boolean queries +unicode fixes

2009-05-20 Thread Aaron Watters
Announcing Nucular 0.5 This release adds streamlined interfaces for boolean queries. Search for "dogs" or "cats" but not "smelly" like this: dicts = session.dictionaries("(dogs|cats) ~smelly") Also included are some other features and bug fixes, including some unicode handling bugfixes. H

When does the escape character work within raw strings?

2009-05-20 Thread walterbyrd
I know that s = r'x\nx' means 'x' followed by a literal '\' followed by an 'n' (the '\n' is not a carriage return). s = r'x\tx' means 'x' followed by a literal '\' followed by an 't' (the '\t' is not a tab). But, boundries seem to work differently. s = re.sub(r'\bxxx\b', 'yyy', s) Is *not* g

Re: The ultimate in voice-powered scripting in Windows... need help

2009-05-20 Thread John Doe
The author provided solutions. Posted to (comp.lang.beta). -- http://mail.python.org/mailman/listinfo/python-list

Re: finding repeated data sequences in a column

2009-05-20 Thread bearophileHUGS
yadin: > How can I build up a program that tells me that this sequence > 128706 > 128707 > 128708 > is repeated somewhere in the column, and how can i know where? Can such patterns nest? That is, can you have a repeated pattern made of an already seen pattern plus something else? If yo

Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread Chris Rebert
On Wed, May 20, 2009 at 9:10 AM, walterbyrd wrote: > On May 20, 9:59 am, Marco Mariani wrote: > >> Do you know what a dictionary is? > > Yes, but I thought  a dictionary used curly brackets. Is the object a > dictionary? Indeed. Note how you're subclassing `UserDict` (its name is similar to `dic

Re: [unladen-swallow] PEP 384: Defining a Stable ABI

2009-05-20 Thread Jeffrey Yasskin
ad? (Where ### could be an ISO date like 20090520.) That would put "ABI" in the macro name and make it easier to define new versions later if necessary. (New versions would help people compile against a new version of Python and be confident they had something that would run against old versio

Re: popen - reading strings - constructing a list from the strings

2009-05-20 Thread norseman
g AttVal.get(). As in if AttVal.get() == ??.. or perhaps local_var_in_function= AttVal.get(). If you reverse the variables mode and text in the 'for mode...' line then you need to reverse the two strings on each line of the feed list. (Or exchange their places in the assignment section :)

Re: finding repeated data sequences in a column

2009-05-20 Thread Tim Chase
lets say you have this column of numbers 128706 128707 128708 100 12 128706 128707 128708 128709 128706 128707 128708 100 12 6 How can I build up a program that tells me that this sequence 128706 128707 128708 is repeated somewhere in the colum

Re: How do I make pprint do this

2009-05-20 Thread Robert Kern
On 2009-05-20 10:37, s...@pobox.com wrote: >> I cannot get pprint to format output how I would like. pydb does. I >> tried grepping the source but still couldn't grok it. That's not the way pprint works. You have no control over how it arranges its output. If you need something mor

Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread Diez B. Roggisch
walterbyrd wrote: > On May 20, 9:59 am, Marco Mariani wrote: > >> Do you know what a dictionary is? > > Yes, but I thought a dictionary used curly brackets. Is the object a > dictionary? foo = {"key" : "i'm the value of a dictionary"} print foo["key"] I suggest you read the tutorial: http:/

Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread walterbyrd
On May 20, 9:59 am, Marco Mariani wrote: > Do you know what a dictionary is? Yes, but I thought a dictionary used curly brackets. Is the object a dictionary? -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a better way to chose a slice of a list?

2009-05-20 Thread walterbyrd
On May 19, 5:31 pm, Ben Finney wrote: > That's just the same micro-goal re-stated. What is your larger problem > of which this is a part? Perhaps a better approach can be suggested when > that context is known. I am processing a huge spreadsheet which I have converted to a csv format. Each row w

Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread Marco Mariani
walterbyrd wrote: > I am sure this is totally simple, but I missing something. Do you know what a dictionary is? -- http://mail.python.org/mailman/listinfo/python-list

Re: finding repeated data sequences in a column

2009-05-20 Thread yadin
On May 20, 11:16 am, bearophileh...@lycos.com wrote: > yadin, understanding what you want is probably 10 times harder than > writing down the code :-) > > > I have a a table, from where I can extract a column. > > You can extract it? Or do you want to extract it? Or do you want to > process it? Etc

Re: Adding a Par construct to Python?

2009-05-20 Thread Luis Zarrabeitia
On Monday 18 May 2009 10:31:06 pm Carl Banks wrote: > Even if you decided to accept the penalty and add locking to > refcounts, you still have to be prepared for context switching at any > time when writing C code, which means in practice you have to lock any > object that's being accessed--that's

Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread walterbyrd
Example 5.6. Coding the FileInfo Class class FileInfo(UserDict): "store file metadata" def __init__(self, filename=None): UserDict.__init__(self)(1) self["name"] = filename(2) What I do not understand is the last line. I thought 'self' was supposed to refer

Re: How do I make pprint do this

2009-05-20 Thread skip
>> I cannot get pprint to format output how I would like. pydb does. I >> tried grepping the source but still couldn't grok it. That's not the way pprint works. You have no control over how it arranges its output. If you need something more flexible you'll have to roll your own. -- Ski

Re: popen - reading strings - constructing a list from the strings

2009-05-20 Thread MRAB
Aytekin Vargun wrote: Hello everybody, I have a question about the way I use os.popen. I am open to other alternative suggestions like using subprocess or communicate. I have an executable (say read_cell_types.exe) that produces string outputs. For example, aft

Re: Adding a Par construct to Python?

2009-05-20 Thread Paul Boddie
On 20 Mai, 15:01, Iain King wrote: > > I was going to write something like this, but you've beat me to it :) > Slightly different though; rather than have pmap collate everything > together then return it, have it yield results as and when it gets > them and stop iteration when it's done, and rena

Re: package with executable

2009-05-20 Thread Stefano Costa
Il Wed, 20 May 2009 07:01:39 +0100, A. Cavallo ha scritto: > With the standard distutils (no need for setuptools) the config.py file > might look like: Right, I ended up using setuptools just because I used paster to create the project layout. I'll think about using plain distutils instead. > i

popen - reading strings - constructing a list from the strings

2009-05-20 Thread Aytekin Vargun
Hello everybody, I have a question about the way I use os.popen. I am open to other alternative suggestions like using subprocess or communicate. I have an executable (say read_cell_types.exe) that produces string outputs. For example, after one execution I got the following outputs in one line:

Re: Conceptual flaw in pxdom?

2009-05-20 Thread Paul Boddie
On 20 Mai, 11:25, "Diez B. Roggisch" wrote: > > Also, not trying to convince people that there are better alternatives to > what and how they do something (admittedly, better is subjective, thus > ensues discussion), or gathering arguments on why they do believe their way > is preferable is the ve

Re: 2d barcode library?

2009-05-20 Thread Christian Heimes
Trevor schrieb: > Is anyone aware of a good library for building 2d barcodes (any format > will work for me) and outputing them as some picture format, > presumably png or bmp to be used for html printing? For 1D barcodes a > simple barcode font will suffice, but obviously 2D is not so simple > and

2d barcode library?

2009-05-20 Thread Trevor
Is anyone aware of a good library for building 2d barcodes (any format will work for me) and outputing them as some picture format, presumably png or bmp to be used for html printing? For 1D barcodes a simple barcode font will suffice, but obviously 2D is not so simple and i have yet to find the ap

Re: Adding a Par construct to Python?

2009-05-20 Thread Grant Edwards
On 2009-05-20, Steven D'Aprano wrote: >> Any Python function that isn't calling a library function written in C >> that releases the GIL won't show any speedup will it? > > Not necessarily. Here's another function, that uses a loop instead of > sleep. > > def g(arg, SIZE=8*10**6): > # Defaul

Re: sqlite3, qmarks, and NULL values

2009-05-20 Thread Marco Mariani
Mitchell L Model wrote: def lookupxy(x, y): if y: conn.execute("SELECT * FROM table WHERE COL1 = ? AND COL2 = ?", (x, y)) else: conn.execute("SELECT * FROM table WHERE COL1 = ? AND COL2 IS NULL", (x,))

Re: How to Spawn a process with P_NOWAIT and pass it some data ?

2009-05-20 Thread MRAB
Barak, Ron wrote: Hi, This is my first try at IPC in Python, and I would like to ask your help with the following problem: I would like to spawn a process with P_NOWAIT, and pass some data to the child process. I created two scripts to try IPC (in a blocking way): $ cat subprocess_sende

Re: sqlite3, qmarks, and NULL values

2009-05-20 Thread Jean-Michel Pichavant
Erratum: please read 'if y is *not* None:'. (think that if y = 0, you won't execute the proper code block with 'if y:'). JM Jean-Michel Pichavant wrote: I fall into the same issue when using postgres. Your main concern is that NULL = NULL will return False. Could seems strange but it has mu

Re: Adding a Par construct to Python?

2009-05-20 Thread Iain King
On May 19, 10:24 am, Steven D'Aprano wrote: > On Mon, 18 May 2009 02:27:06 -0700, jeremy wrote: > > Let me clarify what I think par, pmap, pfilter and preduce would mean > > and how they would be implemented. > > [...] > > Just for fun, I've implemented a parallel-map function, and done a couple >

Re: sqlite3, qmarks, and NULL values

2009-05-20 Thread Jean-Michel Pichavant
I fall into the same issue when using postgres. Your main concern is that NULL = NULL will return False. Could seems strange but it has much advantages sometimes, however this is not the purpose. I found your solution quite acceptable. Just replace 'if y:' by 'if y is None:', add a comment to po

How to Spawn a process with P_NOWAIT and pass it some data ?

2009-05-20 Thread Barak, Ron
Hi, This is my first try at IPC in Python, and I would like to ask your help with the following problem: I would like to spawn a process with P_NOWAIT, and pass some data to the child process. I created two scripts to try IPC (in a blocking way): $ cat subprocess_sender.py #!/usr/bin/env pyth

Problems with import hooks and encoding

2009-05-20 Thread Vinay Sajip
The simple program #-- def main(): print repr(u'\u2029'.encode('utf-8')) if __name__ == "__main__": main() #-- works as expected when run from the command-line, but fails when converted to an executable using PyI

Re: How to get Form values in Python code and Send Email

2009-05-20 Thread Kalyan Chakravarthy
Hi Now i can able to get the form details in to python code, can any one tell me the format to send form values to one Emil id ... for this I required SMTP set up? Thanks in advance Regards Kalyan On Wed, May 20, 2009 at 5:06 PM, James Matthews wrote: > Why don't you use Django? If y

White NaNs with pcolor (matplotlib)

2009-05-20 Thread route6
Hi, I am trying to display the NaNs in white color when I plot a data map using pcolor with matplotlib. Does anyone know how to do that? By default the NaNs are displayed in the color corresponding to the lowest value in the colorbar. Thanks, C -- http://mail.python.org/mailman/listinfo/python-l

Re: How to get Form values in Python code and Send Email

2009-05-20 Thread James Matthews
Why don't you use Django? If you get the form information from Django you can send an email using the send_mail (or even if you don't you can still import the function. On Wed, May 20, 2009 at 8:52 AM, Kalyan Chakravarthy < kalyanchakravar...@hyit.com> wrote: > Hi All, > > I have one doubt,

How do I make pprint do this

2009-05-20 Thread jcervidae
I cannot get pprint to format output how I would like. pydb does. I tried grepping the source but still couldn't grok it. Here: (Pydb) a = range(1,100) (Pydb) pp a [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 3

Re: Is there a better way to chose a slice of a list?

2009-05-20 Thread Piet van Oostrum
> walterbyrd (w) wrote: >w> On May 8, 5:55 pm, John Yeung wrote: >>> On May 8, 3:03 pm,walterbyrd wrote: >>> >>> > This works, but it seems like there should be a better way. >>> >>> > -- >>> > week = ['sun','mon','tue','wed','thu','fri','sat'] >>> > for day in week[week.index(

Re: P2P text chat engine

2009-05-20 Thread Kirill
On 7 май, 21:23, "Diez B. Roggisch" wrote: > Navanjo schrieb: > > > If you have the source code of a p2p text chat engine please send to me > > I found that & a pot of gold under my bed. Care to give me your address > so that I can send it to you? > > SCNR, > Diez Hello, can you sent it to me ? a

finding repeated data sequences in a column

2009-05-20 Thread yadin
Good day everyone! I have a a table, from where I can extract a column. I wanna go down trough that column made of numbers examine undetermined chunks of data and see or detect if that sequence of chunk of data has been repeated before and if it has been repeated detect it by giving it a name in an

  1   2   >