ikaaro 0.20.6 released

2008-07-23 Thread J. David Ibáñez
This is a Content Management System built on Python itools, among other features ikaaro provides: - content and document management (indexsearch, metadata, etc.) - multilingual user interfaces and content - high level modules: wiki, forum, tracker, etc. This is a bug-fix release. Among

Re: xpathEval fails for large files

2008-07-23 Thread Stefan Behnel
Kanch wrote: Original file was 18MB, and contained 288328 element attributes for the particular path. You didn't say how many elements there are in total, but I wouldn't expect that to be a problem, unless you have very little free memory (say, way below 256MB). I just tried with lxml 2.1 and a

Re: tkinter for my python program !!

2008-07-23 Thread karthikbalaguru
On Jul 22, 7:11 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: karthikbalaguru wrote: On Jul 22, 6:32 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: karthikbalaguru wrote: Hi, One of my python program needs tkinter to be installed to run successfully. I am using Redhat 9.0 and

os.walk question

2008-07-23 Thread Lanny
How would one make a list of the files in the top directory using os.walk. I need to pick a random file from said list. Thanks. -- Posted on news://freenews.netfront.net - Complaints to [EMAIL PROTECTED] -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Proper way to query user and group database on a Unix host?

2008-07-23 Thread Chris Brannon
Mike MacCana [EMAIL PROTECTED] writes: Hi folks, What's the proper way to query the passwd and group database on a Unix host? Use the pwd and grp modules, respectively. ## Get the full group database entry, leave just the user list, ## and split the list on comma

Re: sys.stderr.write returns string length in Python 3

2008-07-23 Thread Fredrik Lundh
Alan G Isaac wrote: Can you give me an example of using the returned value? it's for consistency with stream objects that support raw I/O (as described in the PEP). when using buffered I/O, you can ignore it. /F -- http://mail.python.org/mailman/listinfo/python-list

Re: os.walk question

2008-07-23 Thread alex23
On Jul 24, 11:52 am, Lanny [EMAIL PROTECTED] wrote: How would one make a list of the files in the top directory using os.walk. I need to pick a random file from said list. So you -only- want the files from one directory? Try: _, _, files = os.walk('/top/folder/here').next() The single

Re: Proper way to query user and group database on a Unix host?

2008-07-23 Thread Fredrik Lundh
Mike MacCana wrote: What's the proper way to query the passwd and group database on a Unix host? I'd like to fetch the users in a group (obviously from name services), but my many varied searches can't find any reference of someone ever looking up users on a Unix system, just NT. Weird, I

Re: How to replace the values with keys ?

2008-07-23 Thread Fredrik Lundh
Graps Graps wrote: Text2 is a python dictionary containing data as {0: 'a', 1: 'b', 2: 'c'...} now I want the data in text1 to be replaced with the keys, say like 0 1 0 2 0 3 0 6 1 2... so on.. someone asked a very similar question not long ago, so maybe you're really supposed to figure

Re: os.walk question

2008-07-23 Thread Fredrik Lundh
Lanny wrote: How would one make a list of the files in the top directory using os.walk. I need to pick a random file from said list. if you want a list of files from a single directory, use listdir, not walk: import os, random random.choice(os.listdir(/)) 'python25' /F --

mean of arobase in python

2008-07-23 Thread Guilhem Faure
Hello, What means @ in python ? In this script for exemple (this script return an error in my konsole...) @f1(arg) @f2 def func(): pass I see several script where used this symbol but I can't understand. G -- http://mail.python.org/mailman/listinfo/python-list

game programming

2008-07-23 Thread smartx
Game programming became as a box of art and science, the box contains a lot of arts, musics, sounds, graphics,scenario, math, ai and physics ...etc. great department, great skills, great tips, also you can observe your source is the internet that has a lot of articles a lot of great sites like

Re: mean of arobase in python

2008-07-23 Thread Fredrik Lundh
Guilhem Faure wrote: What means @ in python ? usually called at sign in english. In this script for exemple (this script return an error in my konsole...) @f1(arg) @f2 def func(): pass I see several script where used this symbol but I can't understand. in your example, f1(arg) and f2

Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
Hi there, This is my first post over here and I hope someone can give me some guidance. I'm trying to embed Python into a Visual C++ 2008 application and I'm getting linker problems. I've compiled a DLL of the Python source code using the pythoncode VC++ project in the PCbuild folder of the

maximum value in a column of file

2008-07-23 Thread maurizio
which is the best way for the calculation of the maximum value in a column of a file? -- http://mail.python.org/mailman/listinfo/python-list

Re: xpathEval fails for large files

2008-07-23 Thread Kanch
On Jul 23, 11:05 am, Stefan Behnel [EMAIL PROTECTED] wrote: Kanch wrote: Original file was 18MB, and contained 288328 element attributes for the particular path. You didn't say how many elements there are in total, but I wouldn't expect that to be a problem, unless you have very little

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude wrote: 1application.obj : error LNK2031: unable to generate p/invoke for extern C void __clrcall Py_Exit(int) (?Py_Exit@@[EMAIL PROTECTED]); calling convention missing in metadata 1frmPythonInterface.obj : error LNK2031: unable to generate p/invoke for extern C void __clrcall

Re: maximum value in a column of file

2008-07-23 Thread Fredrik Lundh
maurizio wrote: which is the best way for the calculation of the maximum value in a column of a file? what approach have you tried, and what happened when you tried it? /F -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I compare files?

2008-07-23 Thread Gerhard Häring
Clay Hobbs wrote: I am making a program that (with urllib) that downloads two jpeg files and, if they are different, displays the new one. I need to find a way to compare two files in Python. How is this done? There's a module in the standard library called filecmp ;-) -- Gerhard --

Strange problem ....

2008-07-23 Thread karthikbalaguru
Hi, I am new to python, Kindly suggest to resolve a problem with a python file. What does the below error refer to ? I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and db4-4.0.14-20. [EMAIL PROTECTED] processor]# Analyzer processorcycle /usr/local/SDK/bin/../core/bin/processorlib.py:8

Re: Strange problem ....

2008-07-23 Thread Simon Brunning
2008/7/23 karthikbalaguru [EMAIL PROTECTED]: I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and db4-4.0.14-20. File /usr/local/SDK/bin/../core/bin/processorlib.py, line 88 yield ProcessorObjectInfo(child, self.pt) ^ SyntaxError: invalid syntax Is this

Re: Strange problem ....

2008-07-23 Thread Francesco Bochicchio
Il Wed, 23 Jul 2008 01:19:48 -0700, karthikbalaguru ha scritto: Hi, I am new to python, Kindly suggest to resolve a problem with a python file. What does the below error refer to ? I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and db4-4.0.14-20. [EMAIL PROTECTED] processor]#

Re: Uploading an image using PUT

2008-07-23 Thread noelob
Hi All, I finally figured it out, thanks to Wireshark! I was adding my own Content-Length: 50173 header to the request, but httplib appears to add its own header (also Content-Length: 50173) which must have been causing a conflict and making the sever return HTTP/1.1 400 Bad Request\r\n. As soon

Re: maximum value in a column of file

2008-07-23 Thread Chris
On Jul 23, 9:25 am, maurizio [EMAIL PROTECTED] wrote:  which is the best way for the calculation of the maximum value in a     column of a file? oddly enough help(max) Help on built-in function max in module __builtin__: max(...) max(iterable[, key=func]) - value max(a, b, c, ...[,

Is this possible ....

2008-07-23 Thread Stef Mientki
hello, I'm looking for a way to remove duplicate code. The problem is this: In all my modules I've version information, containing version information, date, author, testconditions etc, something like this: Version_Text = [ [ 0.2, '10-02-2008', 'Stef Mientki', 'Test Conditions:', (1,2), _(0,

Re: Re: maximum value in a column of file

2008-07-23 Thread maurizio
i tryed to use the module max of numpy, the problem is that i don't know how to put the column of the file in an array. (i'm new in phyton). anyway if you think there is a better way. Fredrik Lundh wrote: div class=moz-text-flowed style=font-family: -moz-fixedmaurizio wrote: which is

Re: Is this possible ....

2008-07-23 Thread Paul Hankin
On Jul 23, 9:58 am, Stef Mientki [EMAIL PROTECTED] wrote: hello, I'm looking for a way to remove duplicate code. The problem is this: In all my modules I've version information, containing version information, date, author, testconditions etc, something like this: Version_Text = [ [ 0.2,

Re: software engineering foundations?

2008-07-23 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: In my work I have from time-to-time had to pick up and maintain scripts (generally shell/Python stuff) which non-professional programmers have written. It's never what you would call a pleasant task. And yes, for the specific art of writing code that others might

Re: maximum value in a column of file

2008-07-23 Thread Michiel Overtoom
Maurizio wrote... the problem is that i don't know how to put the column of the file in an array. (i'm new in phyton). Give us an example of how your file looks, and what you want to extract from it, so that we don't have to guess. Greetings, -- The ability of the OSS process to collect

Re: maximum value in a column of file

2008-07-23 Thread Fredrik Lundh
maurizio wrote: i tryed to use the module max of numpy, the problem is that i don't know how to put the column of the file in an array. (i'm new in phyton). anyway if you think there is a better way. What kind of file is it? Did you pick numpy because you want to do matrix operations

Re: Function editing with Vim throws IndentError

2008-07-23 Thread Thomas Troeger
ptn wrote: Hi everybody, I have a weird problem. Say I have a .py file with some functions in it, like this: [...] Could someone provide some pointers? Thanks, Pablo Torres N. Have you enabled the `list' option to see which characters are acutally on the lines of interest? Try out

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 9:59 am, Fredrik Lundh [EMAIL PROTECTED] wrote: Jaco Naude wrote: 1application.obj : error LNK2031: unable to generate p/invoke for extern C void __clrcall Py_Exit(int) (?Py_Exit@@[EMAIL PROTECTED]); calling convention missing in metadata 1frmPythonInterface.obj : error

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude wrote: good point. I agree that the problem is probably due to name mangling. I'm not sure how its possible to tell the application that the DLL is a C dll? I've looked at the DLL using Dependency Walker and the functions in the DLL are clean (Thus no name mangling used). How do I

Re: Re: maximum value in a column of file

2008-07-23 Thread maurizio
thank you for your answer actually i've to do some statistics (maximum,minimum,mean,standard deviation,) of a file of data in which each column is a particular type of data. (the file is a tab separated value). I was trying to do this by using python (usually i work with fortran or bash,

logging into a website using python

2008-07-23 Thread leo davis
Hi,   I''m trying achieve the following by running python programs -login to a website -automate filling up web forms   So far I 've tried out the following codes: import cookielib, urllib, urllib2 login = 'cod45' password = 'mell' # Enable cookie support for urllib2 cookiejar =

Re: logging into a website using python

2008-07-23 Thread Fredrik Lundh
leo davis wrote: I''m trying achieve the following by running python programs -login to a website -automate filling up web forms http://twill.idyll.org/ /F -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this possible ....

2008-07-23 Thread Stef Mientki
thanks Paul, your solution works very well. cheers, Stef Paul Hankin wrote: On Jul 23, 9:58 am, Stef Mientki [EMAIL PROTECTED] wrote: You could use version(module) instead of module.version(), and just declare 'version' in one place. Presumably you already have a module for getting

Re: Strange problem ....

2008-07-23 Thread Diez B. Roggisch
karthikbalaguru wrote: Hi, I am new to python, Kindly suggest to resolve a problem with a python file. What does the below error refer to ? I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and db4-4.0.14-20. [EMAIL PROTECTED] processor]# Analyzer processorcycle

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 12:16 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: Jaco Naude wrote: good point. I agree that the problem is probably due to name mangling. I'm not sure how its possible to tell the application that the DLL is a C dll? I've looked at the DLL using Dependency Walker and the

Re: Parsing VHDL with python, where to start.

2008-07-23 Thread c d saunter
Svenn Are Bjerkem ([EMAIL PROTECTED]) wrote: : Hi, : I am in the need to write an application for PyQt to visualise the : structure of a VHDL project I am working on. Looking for a sensible : way to parse VHDL files and putting them into a data structure that : PyQt can represent as a tree (or

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude wrote: What Visual C++ is doing is that it is looking for mangled names since it does not know the DLL contains C functions. I've managed to work around this by declaring the Python functions as follows before using them in the C++ application side: extern C { void

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Fredrik Lundh wrote: cl cl -EHsc -MD -I \python25\include test.cc \python25\libs\python25.lib cut and paste error there: the cl cl should be just one cl, of course. and just for the record/google, if I 1) don't include the header file, I get test.cc(5) : error C3861: 'Py_Initialize':

Re: os.walk question

2008-07-23 Thread alex23
On Jul 23, 5:22 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: if you want a list of files from a single directory, use listdir, not walk:       import os, random       random.choice(os.listdir(/))       'python25' This will include folders as well, though, which isn't what the OP asked for.

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 1:10 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: Jaco Naude wrote: What Visual C++ is doing is that it is looking for mangled names since it does not know the DLL contains C functions. I've managed to work around this by declaring the Python functions as follows before using

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude wrote: That said, let me double check something which might be causing problems since you will be familiar with this. Which Python.h file do you include when including the DLL in your programs? The one in the source distribution of the one in the installation distribution? I've been

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 1:50 pm, Jaco Naude [EMAIL PROTECTED] wrote: On Jul 23, 1:10 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: Jaco Naude wrote: What Visual C++ is doing is that it is looking for mangled names since it does not know the DLL contains C functions. I've managed to work around this

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Ben Sizer
On Jul 23, 11:43 am, Jaco Naude [EMAIL PROTECTED] wrote: What Visual C++ is doing is that it is looking for mangled names since it does not know the DLL contains C functions. I've managed to work around this by declaring the Python functions as follows before using them in the C++ application

Re: Python Written in C?

2008-07-23 Thread mk
Marc 'BlackJack' Rintsch wrote: An operation that most people avoid because of the penalty of shifting down all elements after the deleted one. Pythonistas tend to build new lists without unwanted elements instead. Which is exactly what I have done with my big lxml.etree, from which I

Re: os.walk question

2008-07-23 Thread Larry Bates
Fredrik Lundh wrote: Lanny wrote: How would one make a list of the files in the top directory using os.walk. I need to pick a random file from said list. if you want a list of files from a single directory, use listdir, not walk: import os, random random.choice(os.listdir(/))

Re: Python Written in C?

2008-07-23 Thread mk
Actually, all of the compilers I'm familiar with (gcc and a handful of cross compilers for various microprocessors) translate from high-level languages (e.g. C, C++) into assembly, which is then assembled into relocatable object files, which are then linked/loaded to produce machine language.

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Ben Sizer wrote: You should put the extern block around the #include python.h call rather than individual functions, as surely the C calling convention should apply to everything within. Hello? Python's include files are C++ safe. I even posted a complete compiler session to show that I'm

Re: Proper way to query user and group database on a Unix host?

2008-07-23 Thread Sebastian lunar Wiesner
Chris Brannon [EMAIL PROTECTED]: Iirc since Python 2.5 these tuples are named ... Instead, do this: import grp groupname = 'users' groupusers = grp.getgrnam(groupname)[3] ... thus this line could be written as: groupusers = grp.getgrnam(groupname).gr_mem Slightly more readable, imho

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 2:08 pm, Ben Sizer [EMAIL PROTECTED] wrote: On Jul 23, 11:43 am, Jaco Naude [EMAIL PROTECTED] wrote: What Visual C++ is doing is that it is looking for mangled names since it does not know the DLL contains C functions. I've managed to work around this by declaring the Python

Re: os.walk question

2008-07-23 Thread Fredrik Lundh
alex23 wrote: if you want a list of files from a single directory, use listdir, not walk: import os, random random.choice(os.listdir(/)) 'python25' This will include folders as well, though, which isn't what the OP asked for. as illustrated by my example (cut and pasted

Re: How to replace the values with keys ?

2008-07-23 Thread SvaPs
Hi all.., I tried with this.. def multiple_replace(text,adict): rx=re.compile('|'.join(map(re.escape,adict))) def one_xlat(match): return adict[match.group(0)] return rx.sub(one_xlat,text) print multiple_replace(text,adict) I am thrown with a error: Traceback (most

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude wrote: Fredrik, thanks for the help. I'm not sure why but it seems to work now even if I don't include the extern C command. It also works with both Python.h files (after I copied pyconfig.h from the PC folder). So it seems like everything is working now. As it's supposed to do.

Re: maximum value in a column of file

2008-07-23 Thread Scott David Daniels
maurizio wrote: thank you for your answer actually i've to do some statistics (maximum,minimum,mean,standard deviation,) of a file of data in which each column is a particular type of data. (the file is a tab separated value). I was trying to do this by using python (usually i work with

Re: Python Embedding Thread

2008-07-23 Thread Graham Dumpleton
On Jul 23, 12:15 pm, Jaimy Azle [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I fixed the code. This code snippet runs in a seperate thread: PyObject *dict=NULL; PyGILState_STATE state = PyGILState_Ensure(); dict = CreateMyGlobalDictionary(); PyRun_String(my code, Py_file_input,

Re: maximum value in a column of file

2008-07-23 Thread Fredrik Lundh
maurizio wrote: thank you for your answer actually i've to do some statistics (maximum,minimum,mean,standard deviation,) of a file of data in which each column is a particular type of data. (the file is a tab separated value). I was trying to do this by using python (usually i work with

Re: Problem with Python Server Pages (PSP)

2008-07-23 Thread barun . saha04
On Jul 22, 5:36 pm, Sebastian \lunar\ Wiesner [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] [EMAIL PROTECTED]: Hi, I am facing a very basic problem with PSP. I have installed mod_python (in fedora Core 1), added the lines required for loading Python modules and handling PSP pages. I have

Re: Python Written in C?

2008-07-23 Thread Matthieu Brucher
2008/7/23 mk [EMAIL PROTECTED]: Actually, all of the compilers I'm familiar with (gcc and a handful of cross compilers for various microprocessors) translate from high-level languages (e.g. C, C++) into assembly, which is then assembled into relocatable object files, which are then

Re: os.walk question

2008-07-23 Thread alex23
On Jul 23, 10:11 pm, Larry Bates [EMAIL PROTECTED] wrote: import glob random.choice([f for f in glob.glob(root, *)]) glob.glob only accepts one argument though, did you mean root + *? It also returns folders as well as files, though, and the list comprehension is not necessary given it returns

Re: Problem with Python Server Pages (PSP)

2008-07-23 Thread Graham Dumpleton
On Jul 22, 1:54 pm, [EMAIL PROTECTED] wrote: On Jul 22, 5:18 am, Graham Dumpleton [EMAIL PROTECTED] wrote: On Jul 21, 9:42 pm, [EMAIL PROTECTED] wrote: Hi, I am facing a very basic problem with PSP. I have installedmod_python (in fedora Core 1), added the lines required for

Re: os.walk question

2008-07-23 Thread alex23
On Jul 23, 10:26 pm, Fredrik Lundh [EMAIL PROTECTED] wrote:      random.choice(filter(os.path.isfile, glob.glob(/*))) isn't that bad, though. I'll agree to that. -- http://mail.python.org/mailman/listinfo/python-list

Re: fromfile error on windows, not mac

2008-07-23 Thread Tommy Nordgren
One question : Did you remember to open the file in binary mode? This MUST be done on windows. On 22 jul 2008, at 06.36, jadamwil wrote: Hello, I am using the numpy fromfile function to read binary data from a file on disk. The problem is that the program runs fine on a Mac, but gives an error

Re: maximum value in a column of file

2008-07-23 Thread [EMAIL PROTECTED]
thank you for your answer actually i've to do some statistics (maximum,minimum,mean,standard deviation,) of a file of data in which each column is a particular type of data. (the file is a tab separated value). I was trying to do this by using python (usually i work with fortran or

Re: Problem with Python Server Pages (PSP)

2008-07-23 Thread barun . saha04
On Jul 23, 6:18 pm, Graham Dumpleton [EMAIL PROTECTED] wrote: On Jul 22, 1:54 pm, [EMAIL PROTECTED] wrote: On Jul 22, 5:18 am, Graham Dumpleton [EMAIL PROTECTED] wrote: On Jul 21, 9:42 pm, [EMAIL PROTECTED] wrote: Hi, I am facing a very basic problem with PSP. I have

python.exe crash and ctypes use

2008-07-23 Thread waldek
Hi, I have module A.py and B.dll which exports C functions by cdecl_ In A.py I pass callback (py callable) to dll. Next, thread inside dll simply calls my callback (in a loop). After few secs I got crash of python.exe. How to debug it? I'm using winxp and py 2.5.2

Re: Python Written in C?

2008-07-23 Thread Grant Edwards
On 2008-07-23, mk [EMAIL PROTECTED] wrote: Actually, all of the compilers I'm familiar with (gcc and a handful of cross compilers for various microprocessors) translate from high-level languages (e.g. C, C++) into assembly, which is then assembled into relocatable object files, which are then

Re: python.exe crash and ctypes use

2008-07-23 Thread Diez B. Roggisch
waldek wrote: Hi, I have module A.py and B.dll which exports C functions by cdecl_ In A.py I pass callback (py callable) to dll. Next, thread inside dll simply calls my callback (in a loop). After few secs I got crash of python.exe. How to debug it? I'm using winxp and py 2.5.2

Re: Python Written in C?

2008-07-23 Thread Marc 'BlackJack' Rintsch
On Wed, 23 Jul 2008 14:10:22 +0200, mk wrote: Marc 'BlackJack' Rintsch wrote: I can't even remember when I deleted something from a list in the past. Still, doesn't that strike you as.. workaround? No, I find it actually safer; I don't have to care where modifications of the list might be

Re: python.exe crash and ctypes use

2008-07-23 Thread Thomas Heller
waldek schrieb: Hi, I have module A.py and B.dll which exports C functions by cdecl_ In A.py I pass callback (py callable) to dll. Next, thread inside dll simply calls my callback (in a loop). After few secs I got crash of python.exe. How to debug it? I'm using winxp and py 2.5.2

Doubt

2008-07-23 Thread ജഗന്നാഥ്
Friends I am a Perl programmer new to Python. I have a small doubt. How to convert the perl notation $a = ; expression in Python ? How to represent the loop for ($a = $b; $a=$c;$a++){ } in Python Jagan Linguist -- http://mail.python.org/mailman/listinfo/python-list

Re: Function editing with Vim throws IndentError

2008-07-23 Thread Matimus
On Jul 22, 2:02 pm, ptn [EMAIL PROTECTED] wrote: Hi everybody, I have a weird problem.  Say I have a .py file with some functions in it, like this:     # (...)     def foo():         print(bar) When I open it and add a line to one of the functions,     # (...)     def foo():        

Re: How do I compare files?

2008-07-23 Thread Clay Hobbs
On Tue, 2008-07-22 at 17:29 -0700, Matimus wrote: On Jul 22, 4:27pm, Clay Hobbs [EMAIL PROTECTED] wrote: I am making a program that (with urllib) that downloads two jpeg files and, if they are different, displays the new one. I need to find a way to compare two files in Python. How is this

repr(string)

2008-07-23 Thread David C. Ullrich
I've been saving data in a file with one line per field. Now some of the fields may become multi-line strings... I was about to start escaping and unescaping linefeeds by hand, when I realized that repr() and eval() should do. Hence the question: If s is a string, is repr(s) guaranteed not to

Re: Doubt

2008-07-23 Thread Guilherme Polo
On Wed, Jul 23, 2008 at 11:51 AM, ജഗന്നാഥ് [EMAIL PROTECTED] wrote: Friends I am a Perl programmer new to Python. I have a small doubt. How to convert the perl notation $a = ; expression in Python ? a = How to represent the loop for ($a = $b; $a=$c;$a++){ } in Python for a in

Re: Doubt

2008-07-23 Thread Stephen Johnson
You don't need a mailing list, you need to read the tutorial. Those are completely trivial questions. http://docs.python.org/tut/tut.html -Steve Johnson On Jul 23, 2008, at 10:51 AM, ജഗന്നാഥ് wrote: Friends I am a Perl programmer new to Python. I have a small doubt. How to convert the

Re: repr(string)

2008-07-23 Thread Guilherme Polo
On Wed, Jul 23, 2008 at 12:04 PM, David C. Ullrich [EMAIL PROTECTED] wrote: I've been saving data in a file with one line per field. Now some of the fields may become multi-line strings... I was about to start escaping and unescaping linefeeds by hand, when I realized that repr() and eval()

concatenate the elements in each list of a list of lists

2008-07-23 Thread antar2
I already asked a similar question, but encounter problems with python... How can I concatenate the elements in each list of a list of lists list_of_listsA = [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['arm*', '*', '*(haar)']] wanted result: list_of_listsA = [['klas* * *'] ['mooi* * *

lxml, comparing nodes

2008-07-23 Thread code_berzerker
I'd like to know if there is any built in mechanism in lxml that lets you check equality of two nodes from separate documents. I'd like it to ignore attribute order and so on. It would be even better if there was built in method for checking equality of whole documents (ignoring document order).

Get dict value but not as reference.

2008-07-23 Thread Robert Rawlins
Guys, This feels like a strange question but it's not something I've done before, I'm sure it's quite simple. I have a dictionary, and I want to get one of the values from it, but rather than returning it as a reference I want to actually detach/remove the element from the dictionary. Like

Re: Get dict value but not as reference.

2008-07-23 Thread Jerry Hill
On Wed, Jul 23, 2008 at 11:49 AM, Robert Rawlins [EMAIL PROTECTED] wrote: I have a dictionary, and I want to get one of the values from it, but rather than returning it as a reference I want to actually detach/remove the element from the dictionary. Like so: Use the pop() method of the

Re: Proper way to query user and group database on a Unix host?

2008-07-23 Thread Sebastian lunar Wiesner
Guilherme Polo [EMAIL PROTECTED]: On Wed, Jul 23, 2008 at 9:16 AM, Sebastian lunar Wiesner [EMAIL PROTECTED] wrote: Chris Brannon [EMAIL PROTECTED]: Iirc since Python 2.5 these tuples are named ... Instead, do this: import grp groupname = 'users' groupusers = grp.getgrnam(groupname)[3]

Re: lxml, comparing nodes

2008-07-23 Thread Sebastian lunar Wiesner
code_berzerker [EMAIL PROTECTED]: I'd like to know if there is any built in mechanism in lxml that lets you check equality of two nodes from separate documents. I'd like it to ignore attribute order and so on. It would be even better if there was built in method for checking equality of whole

RE: Get dict value but not as reference.

2008-07-23 Thread Robert Rawlins
Use the pop() method of the dictionary, like this: Ah, of course! Pop! I have seen this before I think Jerry, seems to do the trick nicely. Thank you. Robert -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange problem ....

2008-07-23 Thread karthikbalaguru
On Jul 23, 1:31 pm, Simon Brunning [EMAIL PROTECTED] wrote: 2008/7/23 karthikbalaguru [EMAIL PROTECTED]: I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and db4-4.0.14-20. File /usr/local/SDK/bin/../core/bin/processorlib.py, line 88 yield ProcessorObjectInfo(child, self.pt)

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Martin v. Löwis
1application.obj : error LNK2031: unable to generate p/invoke for extern C void __clrcall Py_Exit(int) (?Py_Exit@@[EMAIL PROTECTED]); calling convention missing in metadata The main problem here is the __clrcall hint: apparently, you are using Managed C++ resp. C++/CLI, i.e. the Microsoft .NET

Re: interpreter vs. compiled

2008-07-23 Thread castironpi
On Jul 22, 11:38 pm, Tim Roberts [EMAIL PROTECTED] wrote: castironpi [EMAIL PROTECTED] wrote: You're saying the VM can't compile code.  That makes sense, it's not a compiler. I wouldn't say can't.  The current CPython VM does not compile code.  It COULD.  The C#/.NET VM does.  IronPython,

Re: concatenate the elements in each list of a list of lists

2008-07-23 Thread Chris
On Jul 23, 5:33 pm, antar2 [EMAIL PROTECTED] wrote: I already asked a similar question, but encounter problems with python... How can I concatenate the elements in each list of a list of lists list_of_listsA = [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['arm*', '*', '*(haar)']]

Re: Python Written in C?

2008-07-23 Thread castironpi
On Jul 23, 9:11 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 23 Jul 2008 14:10:22 +0200, mk wrote: Marc 'BlackJack' Rintsch wrote: I can't even remember when I deleted something from a list in the past. Still, doesn't that strike you as.. workaround? No, I find it

Europe's Best Computer Enthusiast Website, Eurotechzone is now Open!

2008-07-23 Thread Eurotechzone
http://www.eurotechzone.com Catering to the computer enthusiasts from all over the world, Eurotechzone is Europe’s first multi-lingual website on hardware newsreviews. In this site you will find: • The hottest news from IT Bussiness world • The Reviews of the newest electronic

Re: concatenate the elements in each list of a list of lists

2008-07-23 Thread Michael Schneider
Am Wed, 23 Jul 2008 08:33:57 -0700 wrote antar2: I already asked a similar question, but encounter problems with python... How can I concatenate the elements in each list of a list of lists list_of_listsA = [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['arm*', '*', '*(haar)']]

Wrapping std::set in Boost::Python

2008-07-23 Thread Eric First
All: Has anybody had success at wrapping std::set using Boost::Python? Any ideas, snippets of code, etc... would be very helpful. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml, comparing nodes

2008-07-23 Thread code_berzerker
On Jul 23, 6:29 pm, Stefan Behnel [EMAIL PROTECTED] wrote: Your requirements for a single Element are simple enough to write it in three to five lines of Python code (depending on your definition of equality). Checking this equality recursively is another two to three lines. Not complex

Re: Python Written in C?

2008-07-23 Thread Marc 'BlackJack' Rintsch
On Wed, 23 Jul 2008 09:42:29 -0700, castironpi wrote: On Jul 23, 9:11 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 23 Jul 2008 14:10:22 +0200, mk wrote: Marc 'BlackJack' Rintsch wrote: I can't even remember when I deleted something from a list in the past. Still, doesn't

Re: interpreter vs. compiled

2008-07-23 Thread Martin v. Löwis
Oh. How is the stack represented? As usual, as successive locations in memory. I have the impression that CPython uses the same stack C does. Actually, it doesn't (at least not for the evaluation stack). In CPython, when a Python function starts, the maximum depth of the evaluation stack

Segv in mmap.move()

2008-07-23 Thread [EMAIL PROTECTED]
Does anyone recognize this little Python crasher? I'll file a bug report unless someone notices it as an already documented bug. I found some open mmap bugs, but it wasn't obvious to me that this problem was one of those... Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) [GCC 4.2.3 (Ubuntu

Using variables across modules

2008-07-23 Thread Aaron Scott
I'm having some trouble understanding how Python handles variables across multiple modules. I've dug through the documentation, but I still find myself at a loss. When you import a module, are you creating an instance of the variables within? For instance, if I have one file, variables.py, which

Undocumented Python 2.6 change: Py_None vs NULL when C implementation raises exception

2008-07-23 Thread Heikki Toivonen
I was debugging M2Crypto function written in C which changed behavior between Python 2.6 and earlier Python versions. In an error condition the function was supposed to raise exception type A, but with 2.6 it raised type B, and further, there was no string value for the exception. I tracked this

  1   2   >