Re: modifiable config files in compiled code?

2005-03-10 Thread Ksenia Marasanova
You can also do: settings = {} execfile('/path/to/file/myconfig.conf', settings) myconfig.conf is a Python file. After this all variables from myconfig.conf are stored in settings dictionary. -- Ksenia -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote: That's fast and good. Nice to hear. A minor nit-pick: `fdups.py -r .` does nothing (at least on Linux). I'll look into that. Have you found any way to test if two files on NTFS are hard linked without opening them first to get a file handle? No. And even then, I wo

Re: multiple buffers management

2005-03-10 Thread Jaime Wyant
Again, your being vague. You need to be more specific about what you're trying to accomplish. I have no idea what "buffer management" is. If you explain exactly what you're doing then maybe I or someone else could provide you with more meaningful answers. jw On 10 Mar 2005 15:18:08 -0800, [EMA

Re: multiple buffers management

2005-03-10 Thread Bengt Richter
On 10 Mar 2005 15:18:08 -0800, [EMAIL PROTECTED] wrote: >Hello, > >I need to create 6 buffers in python and keep track of it. >I need to pass this buffer, say buffer 1 as an index to a test app. Has > >any one tried to do this. Any help with buffer management appreciated. > >Each buffer needs to h

Distutils spawn on unix acting strange

2005-03-10 Thread Travis Oliphant
I have a normal looking setup.py file with a single extension module. When distutils runs (python setup.py build), the module compiles fine, but an error is issued that seems to indicate that gcc is being called with a "blank" input file (and gives an error). It appears that the spawn proces

Etiquette on job posts

2005-03-10 Thread Mike Wimpe
I know on some boards it's perfectly acceptable to post jobs, but on others its not at all. If I wanted to post a job (Python-related) here, is this OK? Thought I'd ask. Thanks, Mike Wimpe -- http://mail.python.org/mailman/listinfo/python-list

Re: 'Browse' button for *.txt file?

2005-03-10 Thread Fred
Sorry if my choice of words is not very clear to you, but as english is not my first language, I put it this way because of a lack of better words. I will try it differently: What I meant is that I am searching for a module, that would allow me to select a file by not using a typed path, but by cho

Re: Etiquette on job posts

2005-03-10 Thread Robert Kern
Mike Wimpe wrote: I know on some boards it's perfectly acceptable to post jobs, but on others its not at all. If I wanted to post a job (Python-related) here, is this OK? I believe it is okay. Be sure to put [JOB] or something in the Subject. Also, post it to the Python Job Board. http://www.py

Re: 'Browse' button for *.txt file?

2005-03-10 Thread Mike Wimpe
Are you trying to do this within a GUI? If so, wxPython, PyGTK, and PyQT all have ways to do this. You can also use EasyDialogs for this as well. If not, flush... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.4, distutils, and pure python packages

2005-03-10 Thread "Martin v. Löwis"
Thomas Heller wrote: This means that if you build a windows installer using distutils - it *requires* msvcr7.dll in order to run. This is true even if your package is a pure python package. This means that when someone tries to use a windows installer created with Python 2.4, on a machine with only

Re: Etiquette on job posts

2005-03-10 Thread Mike Wimpe
If you are interested in doing some freelance Python development, please take a look at http://www.pythonian.com/info.htm to view our business model. Qualifications: Must have been working with Python for at least a year (though not professionally necessarily) Understand and write OOP Pythonic c

Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1

2005-03-10 Thread "Martin v. Löwis"
Anthony Baxter wrote: On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.1 (release candidate 1). Python 2.4.1 is a bug-fix release. See the release notes at the website (also available as Misc/NEWS in the source distribution) for deta

how to absolute import?

2005-03-10 Thread Qiangning Hong
>From Guido's PEP8: - Relative imports for intra-package imports are highly discouraged. Always use the absolute package path for all imports. Does it mean I should put my develop directory into PYTHONPATH (e.g. /home/hongqn/devel/python) and use "import myproj1.package1.module

Behaviour of htmllib's HTML parser and formatter

2005-03-10 Thread Morten W. Petersen
Hi, I have an HTML page that displays some content, and a part of that content is HTML changed into regular text. The encoding of the page is UTF-8. Here's the code that makes the change (the HTML in self.contents is UTF-8 encoded): file = cStringIO.StringIO() parser = htmllib.HTMLParser(format

[Python-Dev] Re: Adding any() and all()

2005-03-10 Thread Michael Spencer
Guido van Rossum wrote: See my blog: http://www.artima.com/forums/flat.jsp?forum=106&thread=98196 Do we even need a PEP or is there a volunteer who'll add any() and all() for me? Surely these can be written easily with existing constructs: def any(S): return reduce(lambda x, y: bool(x or y), fi

looking up dictionaries by values

2005-03-10 Thread Sandman
Hi there, I'm still a bit new to Python, and had a question. I have a dictionary that looks like: PWD = \ { "root": 0, "joe": 200, "susan": 201, .. } In other words, the values are unique as well as the keys. I've run into a situation where I need to lookup the item by val

Re: thread end and make main program end also?

2005-03-10 Thread martinnitram
Sorry that i had't show my code clearly. The exception try and catch at the module function (i.e. myClass.myfunction(), which like: start code within myClass.py def myfunction(self, dbconnection): sql_query= 'update table set col=value' try: dbconnection.query(sql_query)

Re: modifiable config files in compiled code?

2005-03-10 Thread [EMAIL PROTECTED]
Larry, I am using py2exe to package my application into an executable, but did not have the need for an installer such as Inno Installer. This is definately good info for future use, though. Thank you! Tom, No, I didn't know about the ConfigParser module and was exactly what I was trying to fi

Re: looking up dictionaries by values

2005-03-10 Thread James Stroud
See the thread from earlier today, this list (python-list@python.org). "newbie: dictionary - howto get key value" On Thursday 10 March 2005 06:26 pm, Sandman wrote: > Hi there, > I'm still a bit new to Python, and had a question. > I have a dictionary that looks like: > PWD = \ > { >"root

__getitem__ on new-style classes

2005-03-10 Thread simon
What i'm trying to do is tie special methods of a "proxy" instance to another instance: def test1(): class Container: def __init__( self, data ): self.data = data self.__getitem__ = self.data.__getitem__ data = range(10) c = Container(data) print "test1" print c[3] This

Re: 'Browse' button for *.txt file?

2005-03-10 Thread Steve Holden
Fred wrote: Sorry if my choice of words is not very clear to you, but as english is not my first language, I put it this way because of a lack of better words. I will try it differently: What I meant is that I am searching for a module, that would allow me to select a file by not using a typed path

Re: looking up dictionaries by values

2005-03-10 Thread Steve Holden
Sandman wrote: Hi there, I'm still a bit new to Python, and had a question. I have a dictionary that looks like: PWD = \ { "root": 0, "joe": 200, "susan": 201, .. } In other words, the values are unique as well as the keys. I've run into a situation where I need to lookup t

Re: modifiable config files in compiled code?

2005-03-10 Thread [EMAIL PROTECTED]
Since this utility will also be ported to the linux world, does anyone know what the linux/unix counterpart of a Windows .INI configuration file is? I suppose I could get away with using XML for my config files and avoid having two different tools altogether. -- http://mail.python.org/mailman/li

Re: __getitem__ on new-style classes

2005-03-10 Thread Michael Spencer
[EMAIL PROTECTED] wrote: What i'm trying to do is tie special methods of a "proxy" instance to another instance: ... new style classes: def test2(): print "test2" class Container(object): def __init__( self, data ): self.data = data # self.__dict__["__getitem__"] = self.data.__ge

Re: FW: list reduction

2005-03-10 Thread Stephen Thorne
I think you mean, newlist = [y for y in industrylist if y.cap < x] otherwise you've got a list of caps, not a list of objects with the cap attribute. On Thu, 10 Mar 2005 12:10:31 -0800, James Stroud <[EMAIL PROTECTED]> wrote: > newlist = [y.cap for y in industrylist if y.cap < x] > > On Thursd

Re: modifiable config files in compiled code?

2005-03-10 Thread Tom Willis
ConfigParser works on linux I'm pretty sure. I just ran Ipython imported it and loaded a config file. I don't remember anything in the docs that said otherwise. I would prefer an xml style config file myself. But I can get by with and ini right now. The logging framework seems to me to be the h

Re: PyAsm

2005-03-10 Thread Stephen Thorne
On 10 Mar 2005 12:35:36 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hey Roger, > > I didn't realize that Stefan replied to the list and sent a private > email reply. There seemed to be a lag in google groups today. I > basically told him that I might be crazy enough to write an assembl

Re: Is there a short-circuiting dictionary "get" method?

2005-03-10 Thread Skip Montanaro
Dave> In this snippet: Dave> d = {'x': 1} Dave> value = d.get('x', bigscaryfunction()) Dave> the bigscaryfunction is always called, even though 'x' is a valid Dave> key. I sometimes use value = d.get('x') or bsf() Of course, this bsf() will get called if d['x'] evaluat

Re: select random entry from dictionary

2005-03-10 Thread Skip Montanaro
>> d.popitem() Removes and returns an arbitrary (key, value) pair from d >> If this isn't random enough, then you can generate a random number in >> range(len(d)) Peter> Although this idea may suit the OP, "arbitrary" is most Peter> definitely not "random". Correct. The libr

injecting "set" into 2.3's builtins?

2005-03-10 Thread Skip Montanaro
I use sets a lot in my Python 2.3 code at work and have been using this hideous import to make the future move to 2.4's set type transparent: try: x = set except NameError: from sets import Set as set else: del x Of course, while it's transparent at one

Re: modifiable config files in compiled code?

2005-03-10 Thread Stephen Thorne
On 10 Mar 2005 06:02:22 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi All, > > I've been trying to come up with an elegant solution to this problem, > but can't seem to think of anything better than my solution below. > > I have a Python program that needs to be converted into an execu

Re: injecting "set" into 2.3's builtins?

2005-03-10 Thread Stephen Thorne
On Wed, 9 Mar 2005 19:49:36 -0600, Skip Montanaro <[EMAIL PROTECTED]> wrote: > > I use sets a lot in my Python 2.3 code at work and have been using this > hideous import to make the future move to 2.4's set type transparent: > > try: > x = set > except NameError: > from se

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread David Eppstein
In article <[EMAIL PROTECTED]>, "Xah Lee" <[EMAIL PROTECTED]> wrote: > a absolute requirement in this problem is to minimize the number of > comparison made between files. This is a part of the spec. You need do no comparisons between files. Just use a sufficiently strong hash algorithm (SHA-2

How to launch pdf viewer on Mac?

2005-03-10 Thread Paul McNett
Hi, On Windows, os.startfile() does what I want: os.startfile("myDocument.pdf") That launches the default PDF viewer on the system in a separate process. Perfect. On Linux, I understand that there really isn't a standard for determining a default application for a given file type (indeed, there

Re: split a string with quoted parts into list

2005-03-10 Thread Paul McGuire
Oliver - Here is a simpler approach, hopefully more readable, using pyparsing (at http://pyparsing.sourceforge.net). I also added another test word to your sample input line, one consisting of a lone pair of double quotes, signifying an empty string. (Be sure to remove leading '.'s from Python t

Re: shuffle the lines of a large file

2005-03-10 Thread Heiko Wundram
On Tuesday 08 March 2005 15:55, Simon Brunning wrote: > Ah, but that's the clever bit; it *doesn't* store the whole list - > only the selected lines. But that means that it'll only read several lines from the file, never do a shuffle of the whole file content... When you'd want to shuffle the fil

Re: Is there a short-circuiting dictionary "get" method?

2005-03-10 Thread Terry Reedy
"Skip Montanaro" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >value = d.get('x') or bsf() > > Of course, this bsf() will get called if d['x'] evaluates to false, not > just > None, value = (d.get('x') is not None) or bsf() #?? tjr -- http://mail.python.org/mailman/listi

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread John Bokma
David Eppstein wrote: > In article <[EMAIL PROTECTED]>, > "Xah Lee" <[EMAIL PROTECTED]> wrote: > >> a absolute requirement in this problem is to minimize the number of >> comparison made between files. This is a part of the spec. > > You need do no comparisons between files. Just use a suffici

<    1   2