Re: Reinstall python 2.3 on OSX 10.3.5?

2005-02-02 Thread Robert Kern
Christian Dieterich wrote: On Dé Céadaoin, Feabh 2, 2005, at 17:48 America/Chicago, [EMAIL PROTECTED] wrote: Hi there I started a very long and roundabout process of attempting to install python 2.3.4 along side my apple-installed 2.3 system. To make a long story short, I have completely confabul

Re: Awkwardness of C API for making tuples

2005-02-02 Thread Fredrik Lundh
Dave Cole wrote: > for (i = 0; i < num_values; i++) { > PyObject *obj; > > obj = PyInt_FromLong(value[i]); > if (obj == NULL > || PyTuple_SetItem(tuple, i, obj) != 0) { > Py_DECREF(tuple); > return NULL; > } > } in theory, if PyInt_FromLong succeeds, and PyTuple_SetIte

RE: Crashing Python interpreter! (windows XP, python2.3.4, 2.3.5rc1, 2.4.0)

2005-02-02 Thread Leeuw van der, Tim
-Original Message- From: [EMAIL PROTECTED] on behalf of John Machin Sent: Thu 2/3/2005 12:03 AM To: python-list@python.org Subject: Re: Crashing Python interpreter! (windows XP, python2.3.4, 2.3.5rc1,2.4.0) > Leeuw van der, Tim TOP-POSTED: > > Hi all, > > [...] > > > > Leeuw van der, T

Re: Reference count question

2005-02-02 Thread Fredrik Lundh
John Machin wrote: >> you should check the return value, though. PyList_SetItem may (in >> theory) fail. > > :-) > Only a bot could say that. We mere mortals have been known to do things > like (a) pass a non-list as the first argument (b) pass an out-of-range > value for the second argument. ev

[EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-02 Thread Ilias Lazaridis
" A cooperation between Sun Microsystems and IBM&Co. in conjunction with liberal & high evolutive communities would result in an nearly unbeatable programming platform. My evaluation has shown: this is a non achievable goal, as stubborness and egoism rules - instead of reason and cooperation. Thus

Re: Redirecting stdout/err under win32 platform

2005-02-02 Thread Pierre Barbier de Reuille
David Douard a écrit : Alan, I did search Google for this problem (not enough, thou). In fact, I found some kind of solution (by myself, not that much on Google), but it is not really satisfactory. I have used win32 pipes to do so (win32api.CreatePipe). I can redirect stdout/stderr to it from my py

Re: test_socket.py failure

2005-02-02 Thread x2164
Marc Christiansen <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Nick Coghlan <[EMAIL PROTECTED]> wrote: > >> Hmm, when the second argument is omitted, the system call looks like: > >> > >> getservbyname("daytime", NULL); > >> > >> Based on "man getservbyname" on my Linux PC, that shou

Re: CONTEST - What is the (best) solution?

2005-02-02 Thread Miki Tebeka
Hello Lad, > In a file there can be several dictionaries like this > {Key11: Value11 > Key12: Value12 > Key13: Value13, > ... > ... > Key1n:Value1n} > {Key21: Value21 > Key22: Value22 > Key23: Value23, > ... > ... > Key2n:Value2n} > {Key31: Value31 > Key32: Value32 > Key33: Value33, > ... > ... >

Re: Two classes problem

2005-02-02 Thread Steven Bethard
Gurpreet Sachdeva wrote: The purpose is, I pass a list to a class in a module but I want to use that list out of the scope of that class and that too not in any other class or a function but in the main program... The problem is that when I import that, the statements in the module which are not in

python-2.4.msi installation issue

2005-02-02 Thread mirandacascade
O/S: Windows XP Home (with Service Pack 2) Downloaded python-2.4.msi from python.org (10,632KB). When I double click on the file from Windows Explorer, the installation process presents the window in which I am prompted to either install for all users (the default) or install for just me. I selec

Popularizing SimpleHTTPServer and CGIHTTPServer

2005-02-02 Thread Michele Simionato
Just submitted a recipe with this goal in mind: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/365606 Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Computing class variable on demand?

2005-02-02 Thread Steven Bethard
fortepianissimo wrote: We all know that using __getattr__() we can compute an instance variable on demand, for example: class Foo: def __getattr__ (self, name): if name == 'bar': self.bar = 'apple' return self.bar else: raise AttributeError() Then we can f = Foo() s1 = f.bar s2 = f.bar # this use

Re: Logging

2005-02-02 Thread Samuel Kilchenmann
"Neil Benn" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] Neil Benn wrote: Hello, I'm running a test and having issues with logging, if I call logging.shutdown() and then want to start the logging going again then I get a problem as if I call shutdown, I can't get th

Computing class variable on demand?

2005-02-02 Thread fortepianissimo
We all know that using __getattr__() we can compute an instance variable on demand, for example: class Foo: def __getattr__ (self, name): if name == 'bar': self.bar = 'apple' return self.bar else: raise AttributeError() Then we can f = Foo() s1 = f.bar s2 = f.bar # this uses the "cached" resul

Re: Two classes problem

2005-02-02 Thread Gurpreet Sachdeva
The purpose is, I pass a list to a class in a module but I want to use that list out of the scope of that class and that too not in any other class or a function but in the main program... The problem is that when I import that, the statements in the module which are not in the class are executed f

RE: Python AST Sprint

2005-02-02 Thread Robert Brewer
Timothy Fitz wrote: > I am interested in helping Python, however my knowledge of Abstract > Syntax Trees is lacking. Where should I turn to educate myself? Any > books or websites would be appreciated. Follow the links and advice in this python-dev thread: http://marc.free.net.ph/thread/20050104.0

Re: Reinstall python 2.3 on OSX 10.3.5?

2005-02-02 Thread moa
keerist. I suspected as much. so much for my happy Mac feeling to date. -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-02 Thread Ashot
WingIDE looks nice though, and it seems that the interactive shell is built in from the screenshots. Can you run a program to a certain point break point and use the shell? On Wed, 02 Feb 2005 23:40:40 -0500, Stephen Waterbury <[EMAIL PROTECTED]> wrote: Daniel Bickett wrote: This is certai

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-02 Thread Stephen Waterbury
Daniel Bickett wrote: This is certainly a worthy topic. There are several IDEs for Python (one I like very much being Komodo) that have plenty of fancy debugging features and advanced operations, however I have yet to encounter (elsewhere) the convenience that comes with being able to press F5 and

Re: Atlas and NumPy Problems

2005-02-02 Thread Robert Kern
Robert Kern wrote: Justin Lemkul wrote: Hello all, I am hoping someone out there will be able to help me. I am trying to install a program that utilizes NumPy. In installing NumPy, I realized that I was lacking Atlas. I ran into the following problems installing Atlas and NumPy, as I realized

Re: Awkwardness of C API for making tuples

2005-02-02 Thread Dave Cole
John Machin wrote: Dave Opstad wrote: One of the functions in a C extension I'm writing needs to return a tuple of integers, where the length of the tuple is only known at runtime. I'm currently doing a loop calling PyInt_FromLong to make the integers, What is the purpose of this first loop? In wh

Re: streaming a file object through re.finditer

2005-02-02 Thread Steven Bethard
Erick wrote: Hello, I've been looking for a while for an answer, but so far I haven't been able to turn anything up yet. Basically, what I'd like to do is to use re.finditer to search a large file (or a file stream), but I haven't figured out how to get finditer to work without loading the entire f

Re: Easy Q: dealing with object type

2005-02-02 Thread Steven Bethard
Erik Johnson wrote: "Erick" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Ah, you're running into the "old-style classes vs. new style classes". Try subclassing from "object". For example: class A(object): That works! :) I guess I am fortunate to be running 2.2 - looks kinda ugly prio

Re: Generating .pyc/.pyo from a make file

2005-02-02 Thread vincent wehren
Tim Daneliuk wrote: Steve Holden wrote: Roland Heiber wrote: Tim Daneliuk wrote: Aha! Exactly ... and that makes perfect sense too. D'oh! I guess a better distribution strategy would be to have the installation program generate the pyo file at installation time... Thanks - Also, the *.py? fil

Re: Reinstall python 2.3 on OSX 10.3.5?

2005-02-02 Thread Christian Dieterich
On Dé Céadaoin, Feabh 2, 2005, at 17:48 America/Chicago, [EMAIL PROTECTED] wrote: Hi there I started a very long and roundabout process of attempting to install python 2.3.4 along side my apple-installed 2.3 system. To make a long story short, I have completely confabulated my environment ( i del

Re: Finding user's home dir

2005-02-02 Thread Christian Dieterich
On Dé Céadaoin, Feabh 2, 2005, at 13:26 America/Chicago, Nemesis wrote: Hi all, I'm trying to write a multiplatform function that tries to return the actual user home directory. I saw that Please, could you test it on your systems and tell me what you got? I'd like to know what it returns on diffe

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-02 Thread Daniel Bickett
This is certainly a worthy topic. There are several IDEs for Python (one I like very much being Komodo) that have plenty of fancy debugging features and advanced operations, however I have yet to encounter (elsewhere) the convenience that comes with being able to press F5 and have an interactive in

Re: streaming a file object through re.finditer

2005-02-02 Thread Daniel Bickett
Erick wrote: > True, but it doesn't work with multiline regular expressions :( If your intent is for the expression to traverse multiple lines (and possibly match *across* multiple lines,) then, as far as I know, you have no choice but to load the whole file into memory. -- Daniel Bickett dbicke

Re: streaming a file object through re.finditer

2005-02-02 Thread Erik Johnson
Is it not possible to wrap your loop below within a loop doing file.read([size]) (or readline() or readlines([size]), reading the file a chunk at a time then running your re on a per-chunk basis? -ej "Erick" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ack, typo. What I mea

Delivery failed

2005-02-02 Thread Post Office
The original message was received at Thu, 3 Feb 2005 08:03:02 +0500 from [182.255.28.192] - The following addresses had permanent fatal errors - python-list@python.org - Transcript of session follows - ... while talking to 72.27.31.20: 550 5.1.2 ... Host unknown (Name server: host

Re: Easy Q: dealing with object type

2005-02-02 Thread Erik Johnson
"Erick" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ah, you're running into the "old-style classes vs. new style classes". > Try subclassing from "object". > > For example: > > >>> class A(object): That works! :) I guess I am fortunate to be running 2.2 - looks kinda ugly prior

Re: Finding user's home dir

2005-02-02 Thread Kartic
Nemesis said the following on 2/2/2005 2:26 PM: Hi all, I'm trying to write a multiplatform function that tries to def getHomeDir(): ''' Try to find user's home directory, otherwise return current directory.''' Please, could you test it on your systems and tell me what you got? I'd like to kno

Re: Reinstall python 2.3 on OSX 10.3.5?

2005-02-02 Thread Robert Kern
[EMAIL PROTECTED] wrote: Hi there I started a very long and roundabout process of attempting to install python 2.3.4 along side my apple-installed 2.3 system. To make a long story short, I have completely confabulated my environment ( i deleted the 2.3 binaries and so forth from the system in an at

IDLE history, Python IDE, and Interactive Python with Vim

2005-02-02 Thread Ashot
This is sort of both Python and Vim related (which is why I've posted to both newsgroups). Python related: -- I have been frustrated for quite some time with a lack of a history command in IDLE (in fact with IDLE in general). Often I'll develop new code at the command li

Python AST Sprint

2005-02-02 Thread Timothy Fitz
I am interested in helping Python, however my knowledge of Abstract Syntax Trees is lacking. Where should I turn to educate myself? Any books or websites would be appreciated. -- http://mail.python.org/mailman/listinfo/python-list

Re: CONTEST - What is the (best) solution?

2005-02-02 Thread Daniel Bickett
Cappy2112 wrote: > > dictionaries can NOT contain dictionaries. > > Who told you this? > In my python, they can. > [snip] You took his reply out of context. Fuzzyman asked him if *his* dictionaries were to contain dictionaries, and the reply was no, they will not. -- Daniel Bickett dbickett at

Re: streaming a file object through re.finditer

2005-02-02 Thread Erick
True, but it doesn't work with multiline regular expressions :( -e -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy Q: dealing with object type

2005-02-02 Thread Erick
Ah, you're running into the "old-style classes vs. new style classes". Try subclassing from "object". For example: >>> class A(object): ... pass ... >>> a=A() >>> type(a) >>> type(a) == A True >>> type(a) is A True >>> b=A() >>> type(a) == type(b) True >>> type(a) is type(b) True Check out t

Re: streaming a file object through re.finditer

2005-02-02 Thread Erick
Ack, typo. What I meant was this: cat a b c > blah >>> import re >>> for m in re.finditer('\w+', file('blah')): ... print m.group() ... Traceback (most recent call last): File "", line 1, in ? TypeError: buffer object expected Of course, this works fine, but it loads the file completely into m

Re: streaming a file object through re.finditer

2005-02-02 Thread Daniel Bickett
The following example loads the file into memory only one line at a time, so it should suit your purposes: >>> data = file( "important.dat" , "w" ) >>> data.write("this\nis\nimportant\ndata") >>> data.close() now read it >>> import re >>> data = file( "important.dat" , "r" ) >>> line = data.

Re: Easy Q: dealing with object type

2005-02-02 Thread Erick
Ah, you're running into the "old-style classes vs. new style classes". Try subclassing from "object". For example: >>> class A(object): ... pass ... >>> a=A() >>> type(a) >>> type(a) == A True >>> type(a) is A True >>> b=A() >>> type(a) == type(b) True >>> type(a) is type(b) True Check out t

Re: how about writing some gui to a known console application

2005-02-02 Thread Grant Edwards
On 2005-02-01, alexrait1 <[EMAIL PROTECTED]> wrote: > I tried to delete this message, but I guess it was too late... or it > didn't work for me... sorry anyway. No worries. Since the article didn't have a refereces or in-reply-to header, it showed up as the first post in it's own thread. I late

Re: Easy Q: dealing with object type

2005-02-02 Thread Daniel Bickett
On Erik Johnson wrote: > # The following "works", but I don't want to keep a set of instances to > compare against > >>> obj2 = A() > >>> type(obj) == type(obj2) > 1 How about: >>> class A: pass >>> class B: pass >>> objA = A() >>> type( objA ) == type( A() ) True then again

Re: how about writing some gui to a known console application

2005-02-02 Thread Grant Edwards
On 2005-02-01, Jeremy Bowers <[EMAIL PROTECTED]> wrote: > On Tue, 01 Feb 2005 21:57:45 +, Grant Edwards wrote: > >> On 2005-02-01, alexrait1 <[EMAIL PROTECTED]> wrote: >> >>> Do something useful... (at least for me) For instance I need a gtk >>> frontend for pgp. So here you can have an opport

streaming a file object through re.finditer

2005-02-02 Thread Erick
Hello, I've been looking for a while for an answer, but so far I haven't been able to turn anything up yet. Basically, what I'd like to do is to use re.finditer to search a large file (or a file stream), but I haven't figured out how to get finditer to work without loading the entire file into mem

Easy Q: dealing with object type

2005-02-02 Thread Erik Johnson
I quickly browsed through section 9 of the Tutorial, tried some simple Google searches: I'm not readily seeing how to test class type. Given some object (might be an instance of a user-created class, might be None, might be list, might be some other "standard" type object instance), how do yo

Re: CONTEST - What is the (best) solution?

2005-02-02 Thread Cappy2112
> dictionaries can NOT contain dictionaries. Who told you this? In my python, they can. d1={1:"one"} >>> d2={2:"two"} >>> d1 {1: 'one'} >>> d2 {2: 'two'} >>> d3={3:d2} >>> d3 {3: {2: 'two'}} [EMAIL PROTECTED] wrote: > Fuzzyman wrote: > > Can your dictionaries contain dictionaries ? > Hi Fuzzy,

Re: Suggesion for an undergrad final year project in Python

2005-02-02 Thread JanC
Kartic schreef: > Or if you are the networking types, come up with a peer-to-peer chat > application with whitetboard capability, which I am sure will be fairly > novel. Hm, a Python version of The Coccinella? :-) -- JanC "Be strict when sending and tolerant when receiving." RFC 1958 - Arch

Re: python and gpl

2005-02-02 Thread JanC
Paul Rubin schreef: > My IANAL amateur reading is that the GPL does in fact apply, at least > in the US. Running the program is not restricted, but loading the > program from disk to memory before you can run it counts as copying > it, which invokes the license, Computer Associates v. Altai, 982

Re: XML with Unicode: what am I doing wrong?

2005-02-02 Thread Kevin Dangoor
In article news.t-online.com>, "Diez B. Roggisch" web.de> wrote: you confuse unicode with utf8. Expat can parse the latter - the former is internal to python. And passing it to something that needs a string will result in a conversion - which fails because of the ascii encoding. Ahh... that make

Re: Newbie alert

2005-02-02 Thread Timo Virkkala
Valone, Toren W. wrote: Traceback (most recent call last): File "C:/Python24/dialog1.py", line 29, in -toplevel- d = MyDialog(root) NameError: name 'MyDialog' is not defined Suggestion: Read the place in your code where MyDialog is defined and compare it with where it is used. Check case. Yo

Re: global variables

2005-02-02 Thread M.E.Farmer
Ok it has been a long day, In my reply to Steven Bethard , Steve should read Steven ;) M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

managing multiple subprocesses

2005-02-02 Thread Marcos
Hi guys, I realise this question has been answered in one form or another many times before but I can't quite find the solution I need. I am trying to run multiple subprocesses from a python script and then wait until all subprocesses have completed before continuing. The subprocesses run on other

Re: global variables

2005-02-02 Thread M.E.Farmer
Steve, Yes I agree ;) Never use builtin names. I know better but missed it somehow. I apologize for any confusion I may have caused. Thank you Steve for the correction. M.E.Farmer Steven Bethard wrote: > M.E.Farmer wrote: > > alex wrote: > >> is it possible to create 'global' variables that can be

Re: Finding user's home dir

2005-02-02 Thread Nick
Python 2.4 (#1, Jan 1 2005, 21:33:55) [GCC 3.3.4] on linux2 Slackware 10 Current Works! Nice. -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing Filenames with non-Ascii-Characters

2005-02-02 Thread aurora
> print d.encode('cp437') So I would have to specify the encoding on every call to print? I am sure to forget and I don't like the program dying, in my case garbled output would be much more acceptable. Marian I'm with you. You never known you have put enough encode in all the right places a

Re: global variables

2005-02-02 Thread Larry Bates
One way to to this is by using keyword args: class a: def __init__(self, arg1, arg2, **kwargs): # # Dictionary kwargs will have keyword, value pairs # that can be used as global space. # self.arg1=arg1 self.arg2=arg2 self.__dict__.update(k

Re: global variables

2005-02-02 Thread Steven Bethard
M.E.Farmer wrote: alex wrote: is it possible to create 'global' variables that can be seen in all other classes? What about using a class? Py> class globalVar: ...pass Py> globals = globalVar() Probably naming it something other than 'globals' would be a good idea -- otherwise you'll hide the

managing multiple subprocesses

2005-02-02 Thread Marcos
Hi guys, I realise this question has been answered in one form or another many times before but I can't quite find the solution I need. I am trying to run multiple subprocesses from a python script and then wait until all subprocesses have completed before continuing. The subprocesses run on other

Re: Is this a contradiction in the docs ?

2005-02-02 Thread Terry Reedy
"Fuzzyman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Equally possible (or more likely !) is that I misunderstand it : Or that you did not sufficiently test the indicated difference ;-) > The docs for compile say that if you are creating a code object from a > sequence of sta

Re: global variables

2005-02-02 Thread M.E.Farmer
alex wrote: > Hi, > > is it possible to create 'global' variables that can be seen in all > other classes? > > Alex Hello, What about using a class? Py> class globalVar: ...pass Py> globals = globalVar() Now you can assign 'variables' to it. And use it anywhere you need it. Py> globals.imag

Reinstall python 2.3 on OSX 10.3.5?

2005-02-02 Thread moa
Hi there I started a very long and roundabout process of attempting to install python 2.3.4 along side my apple-installed 2.3 system. To make a long story short, I have completely confabulated my environment ( i deleted the 2.3 binaries and so forth from the system in an attempt to start things fr

Re: Newbie alert

2005-02-02 Thread Steve Holden
Valone, Toren W. wrote: Ok, new to Python and Tkinter.. Following along examples in book, got to dialog windows example coded this # dialog1.py from Tkinter import * class Mydialog: [...] d = MyDialog(root) root.wait_window(d.top) When I run it IDLE

Re: Generating .pyc/.pyo from a make file

2005-02-02 Thread Steve Holden
Tim Daneliuk wrote: Steve Holden wrote: Roland Heiber wrote: Tim Daneliuk wrote: It does - thanks. One more question: Are pyc and pyo file portable across operating systems? I suspect not since I generated a pyo on a FreeBSD machine that will not run on a Win32 machine. I was under the impressi

Re: Generating .pyc/.pyo from a make file

2005-02-02 Thread Tim Daneliuk
Steve Holden wrote: Roland Heiber wrote: Tim Daneliuk wrote: It does - thanks. One more question: Are pyc and pyo file portable across operating systems? I suspect not since I generated a pyo on a FreeBSD machine that will not run on a Win32 machine. I was under the impression that "compiled" m

Newbie alert

2005-02-02 Thread Valone, Toren W.
Ok, new to Python and Tkinter.. Following along examples in book, got to dialog windows example coded this # dialog1.py from Tkinter import * class Mydialog: def _int_(self,parent): top = self.top = Toplevel(parent) Label(top, text="Value").pack() self.e = Entry(top

Re: Basic file operation questions

2005-02-02 Thread David Douard
David Douard wrote: > Marcel van den Dungen wrote: > >> alex wrote: >>> Hi, >>> >>> I am a beginner with python and here is my first question: >>> How can I read the contents of a file using a loop or something? I open >>> the file with file=open(filename, 'r') and what to do then? Can I use >>>

Re: global variables

2005-02-02 Thread Steve Holden
alex wrote: Hi, is it possible to create 'global' variables that can be seen in all other classes? Alex Not sensibly, though you can mess around with the __builtin__ namespace to make values accessible without qualification. The usual solution is to maintain a config module that establishes defa

Re: Basic file operation questions

2005-02-02 Thread David Douard
Marcel van den Dungen wrote: > alex wrote: >> Hi, >> >> I am a beginner with python and here is my first question: >> How can I read the contents of a file using a loop or something? I open >> the file with file=open(filename, 'r') and what to do then? Can I use >> something like >> >> for xxx i

Re: Generating .pyc/.pyo from a make file

2005-02-02 Thread Steve Holden
Roland Heiber wrote: Tim Daneliuk wrote: It does - thanks. One more question: Are pyc and pyo file portable across operating systems? I suspect not since I generated a pyo on a FreeBSD machine that will not run on a Win32 machine. I was under the impression that "compiled" meant optimized byte

Re: continuous plotting with Tkinter

2005-02-02 Thread David Douard
Martin Blume wrote: > I have a number-crunching application that spits out > a lot of numbers. Now I'd like to pipe this into a python > app and plot them using Tkinter, such as: > $ number_cruncher | myplot.py > But with Tkinter once I call Tkinter's mainloop() I > give up my control of the app

Re: Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
Steve Holden wrote: But I also want the bytecode of modules that don't have a .pyc file, possibly because they have already been 'dynamically' loaded from another bytecode string ;-) Aah, right, I suspect in these cases (which *are* pretty far from the ordinary run of things) you'd sometimes be up

Re: Generating .pyc/.pyo from a make file

2005-02-02 Thread Roland Heiber
Tim Daneliuk wrote: It does - thanks. One more question: Are pyc and pyo file portable across operating systems? I suspect not since I generated a pyo on a FreeBSD machine that will not run on a Win32 machine. I was under the impression that "compiled" meant optimized byte code that was portabl

Re: Integrated Testing - Peppable?

2005-02-02 Thread John Roth
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, Please excuse the intrusion from an admirer, but not a user, of Python. I've got an idea that I think could improve the language and might be relatively simple to implement. I've developed a prototype with a toy language here:

Re: Generating .pyc/.pyo from a make file

2005-02-02 Thread Tim Daneliuk
Roland Heiber wrote: Tim Daneliuk wrote: I use a makefile to create distribution tarballs of freestanding Python programs and their documentation. I cannot seem to find the right command line option to just generate a pyc/pyo file from the program and then exit. If I use 'python - -c"import m

Re: Reference count question

2005-02-02 Thread John Machin
Fredrik Lundh wrote: > > >PyList_SetItem(List,i,Str); > > you should check the return value, though. PyList_SetItem may (in > theory) fail. > :-) Only a bot could say that. We mere mortals have been known to do things like (a) pass a non-list as the first argument (b) pass an out-of-range va

pyFMOD problem

2005-02-02 Thread Tian
I am trying to use pyfmod in python to manipulate sound. i have installed pyfmod, ctype, numarray (if they are necessary), i also copied fmod.dll to python/DLLs as well as windows/system32, but when i tried import pyFMOD I got: Traceback (most recent call last): File "", line 1, in -topleve

Re: Getting a module's byte code, how?

2005-02-02 Thread Steve Holden
Irmen de Jong wrote: Steve Holden wrote: Having said which, if the module was loaded from a .pyc file then the bytecode is available from that - take everything but the first eight bytes and use marshal.loads() to turn it back into a code object: Yup. As I explained in the other message, this is

global variables

2005-02-02 Thread alex
Hi, is it possible to create 'global' variables that can be seen in all other classes? Alex -- http://mail.python.org/mailman/listinfo/python-list

Question about pyFMOD importing

2005-02-02 Thread Tian
I am trying to use pyFMOD, I have installed all other supporting libraries (hopefully), such as ctypes, numarray, I also installed FMOD itself and copied its DLL files to python/DLLs. When I try to import pyFMOD in python, i got this message: >>> import pyFMOD Traceback (most recent call last):

Re: Crashing Python interpreter! (windows XP, python2.3.4, 2.3.5rc1, 2.4.0)

2005-02-02 Thread John Machin
Leeuw van der, Tim TOP-POSTED: > Hi all, > > I can use this version of gtk and PyGtk to run simple programs. There seems to be no problem with the code-completion in PythonWin. > I can do: dir(gtk) without problems after importing the gtk module of PyGtk, when I use idle or console. (Python versio

Re: Generating .pyc/.pyo from a make file

2005-02-02 Thread Roland Heiber
Tim Daneliuk wrote: I use a makefile to create distribution tarballs of freestanding Python programs and their documentation. I cannot seem to find the right command line option to just generate a pyc/pyo file from the program and then exit. If I use 'python - -c"import myprog"' it creates th

Re: Python's idiom for function overloads

2005-02-02 Thread Stephen Thorne
On Wed, 02 Feb 2005 14:45:35 -0800 (PST), Simo Melenius <[EMAIL PROTECTED]> wrote: > Philippe Fremy <[EMAIL PROTECTED]> writes: > > > You can not reproduce the C++ overload idiom but you can get something > > close with manual type testing. > > > > > To in a > > > function do an if statement wit

Re: Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
Steve Holden wrote: I'm not sure why you think the module's code would be needed once it's been executed. That assigns all necessary code blocks to the functions defined therein, so the code, once the import has been executed, is garbage (from the interpreter's rather process-centric view of thi

Re: Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
Steve Holden wrote: Having said which, if the module was loaded from a .pyc file then the bytecode is available from that - take everything but the first eight bytes and use marshal.loads() to turn it back into a code object: Yup. As I explained in the other message, this is basically what I'm do

Re: Python's idiom for function overloads

2005-02-02 Thread Simo Melenius
Philippe Fremy <[EMAIL PROTECTED]> writes: > You can not reproduce the C++ overload idiom but you can get something > close with manual type testing. > > > To in a > > function do an if statement with the type() function? > > I am not aware of any other method. > > def a( arg1 ): > if t

Re: Getting a module's byte code, how?

2005-02-02 Thread Steve Holden
Irmen de Jong wrote: Mark Nenadov wrote: On Wed, 02 Feb 2005 23:03:17 +0100, Irmen de Jong wrote: What would be the best way, if any, to obtain the bytecode for a given loaded module? I can get the source: import inspect import os src = inspect.getsource(os) but there is no ispect.getbytecode() ;

Re: Getting a module's byte code, how?

2005-02-02 Thread Steve Holden
Mark Nenadov wrote: On Wed, 02 Feb 2005 23:03:17 +0100, Irmen de Jong wrote: What would be the best way, if any, to obtain the bytecode for a given loaded module? I can get the source: import inspect import os src = inspect.getsource(os) but there is no ispect.getbytecode() ;-) --Irmen The inspe

Re: Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
Mark Nenadov wrote: On Wed, 02 Feb 2005 23:03:17 +0100, Irmen de Jong wrote: What would be the best way, if any, to obtain the bytecode for a given loaded module? I can get the source: import inspect import os src = inspect.getsource(os) but there is no ispect.getbytecode() ;-) --Irmen The inspe

Re: set, dict and other structures

2005-02-02 Thread Simo Melenius
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > Just today I was writing some code where I wanted to use sets for > the abstraction (intersection, etc.), but also carry some values > with them to process. So, yes, I believe that having set-like > abstraction for dictionaries would be great. In fact,

Generating .pyc/.pyo from a make file

2005-02-02 Thread Tim Daneliuk
I use a makefile to create distribution tarballs of freestanding Python programs and their documentation. I cannot seem to find the right command line option to just generate a pyc/pyo file from the program and then exit. If I use 'python - -c"import myprog"' it creates the pyo file, but mypr

Re: Getting a module's byte code, how?

2005-02-02 Thread Mark Nenadov
On Wed, 02 Feb 2005 23:03:17 +0100, Irmen de Jong wrote: > What would be the best way, if any, to obtain > the bytecode for a given loaded module? > > I can get the source: > import inspect > import os > src = inspect.getsource(os) > > but there is no ispect.getbytecode() ;-) > > --Irmen The

Re: Basic file operation questions

2005-02-02 Thread Steve Holden
alex wrote: Hi, I am a beginner with python and here is my first question: How can I read the contents of a file using a loop or something? I open the file with file=open(filename, 'r') and what to do then? Can I use something like for xxx in file: Yes, indeed you can. That's by no means *a

Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
What would be the best way, if any, to obtain the bytecode for a given loaded module? I can get the source: import inspect import os src = inspect.getsource(os) but there is no ispect.getbytecode() ;-) --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: pythonic equivalent of Mathematica's FixedPoint function

2005-02-02 Thread Terry Reedy
"jelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >You could probably write your own FixedPoint function without too much >>difficulty, with the only tricky part being for it to know when to > stop! > > It would be quite interesting to have this kind of function. But > likely

Re: Basic file operation questions

2005-02-02 Thread Marcel van den Dungen
alex wrote: Hi, I am a beginner with python and here is my first question: How can I read the contents of a file using a loop or something? I open the file with file=open(filename, 'r') and what to do then? Can I use something like for xxx in file: Thanks for help Alex take a look at this:

errors

2005-02-02 Thread Joel Eusebio
Can someone help me on this, I don' know where the "testmptest" came from but the mptest.py is at the /usr/local/apache2/htdocs/test directory and this error came from apache's error_log PythonHandler mod_python.publisher: ImportError: No module named testmptest Thanks, Joel -- http://mail.py

Re: Basic file operation questions

2005-02-02 Thread Caleb Hattingh
Hi Alex Assuming you have a file called "data.txt": *** f = open('data.txt','r') lines = f.readlines() f.close() for line in lines: print line *** Will print each line of the file. You can make a huge investment by setting 2 or 3 hours aside to go through the Python tutorial, which gets insta

Re: Two classes problem

2005-02-02 Thread Caleb Hattingh
Steven, thanks for your help once again :) so you could write the code like: test = 'first' class aclass: def __init__(self, value): mod = __import__(__name__) mod.test = value This is sweet. I really like this technique for manipulating module-scope identifiers (from with

Re: Generating modul classes with eval

2005-02-02 Thread Jeremy Bowers
On Wed, 02 Feb 2005 16:20:41 -0500, Jeremy Bowers wrote: > That said, "__main__" indicates you ran it in the interactive shell. Or ran it directly on the command line. Duh. I thought that clause really loudly, but I guess I never actually typed it. -- http://mail.python.org/mailman/listinfo/pytho

  1   2   3   >