can i write a assemly language programs in python

2009-07-09 Thread m.reddy prasad reddy
can any one tell me how to write assembly language programs in python...if no is there any other way to write the programs in python Reddi prasad reddy ph.no:09958083797 -- http://mail.python.org/mailman/listinfo/python-list

Re: count

2009-07-09 Thread Paul Rubin
a...@pythoncraft.com (Aahz) writes: > When dealing with small N, O() can get easily swamped by the constant > factors. How often do you deal with more than a hundred fields? The number of fields in the OP's post was not stated. Expecting it to be less than 100 seems like an ill-advised presumpti

PyGtk Depends on Numeric

2009-07-09 Thread dieter
Get with the times people and port to numpy. :P Don't you think its about time? ~Pete -- http://mail.python.org/mailman/listinfo/python-list

Re: ... remove all 0 values

2009-07-09 Thread Daniel Austria
Thanks a lot for your advices, i decided to use the filter() method to sort out the 0. i can ´t use the sum() function cause i need the list afterwards best, Dan -- http://mail.python.org/mailman/listinfo/python-list

i need immediate help from u

2009-07-09 Thread m.reddy prasad reddy
i m new this community .; can any one send me the solution for writing the assembly language programs in python my mail ID:redd@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: i need immediate help from u

2009-07-09 Thread Chris Rebert
On Thu, Jul 9, 2009 at 12:25 AM, m.reddy prasad reddy wrote: > i m new this community .; > can any one send me the solution for writing the assembly language programs > in python > my mail ID:redd@gmail.com Please read http://catb.org/esr/faqs/smart-questions.html Cheers, Chris -- http://blo

Re: regex help

2009-07-09 Thread Peter Otten
David wrote: >   > > Open: > > 5.50 > >   > Mkt Cap: > > 6.92M > >   > P/E: > > 21.99 > > > > I want to extract the open, mkt cap and P/E values - but apart from > doing loads of indivdual REs which I think would look messy, I can't > think of a better and neater looking way. Any ideas?

Re: Problem reading file with umlauts

2009-07-09 Thread Claus Hausberger
Thanks a lot. I will try that on the weekend. Claus > Claus Hausberger wrote: > > Thanks a lot. Now I am one step further but I get another strange error: > > > > Traceback (most recent call last): > > File "./read.py", line 12, in > > of.write(text) > > UnicodeEncodeError: 'ascii' codec

Re: Clarity vs. code reuse/generality

2009-07-09 Thread Gabriel Genellina
En Wed, 08 Jul 2009 23:19:25 -0300, kj escribió: In Tim Rowe writes: 2009/7/4 kj : Precisely. =A0As I've stated elsewhere, this is an internal helper function, to be called only a few times under very well-specified conditions. =A0The assert statements checks that these conditions are

Re: Check file is locked?

2009-07-09 Thread Rajat
On Jul 8, 12:45 pm, Tim Golden wrote: > Rajat wrote: > > On Jul 8, 4:57 am, Lawrence D'Oliveiro > central.gen.new_zealand> wrote: > >> In message , Christian > > >> Heimes wrote: > >>> By the way most operating systems don't lock a file when it's opened for > >>> reading or writing or even execut

Re: tkinter problem

2009-07-09 Thread Peter Otten
Paul Simon wrote: > "Chris Rebert" wrote in message > news:mailman.2863.1247095339.8015.python-l...@python.org... > On Wed, Jul 8, 2009 at 4:18 PM, Paul Simon wrote: >> I have the "tkinter" problem and need some assistance to straighten it >> out. >> >From the web page "http://wiki.python.org/moi

Re: Problem with list of dicts and copying

2009-07-09 Thread Gabriel Genellina
En Wed, 08 Jul 2009 14:09:43 -0300, Cameron Pulsford escribió: I'm representing the board as a dictionary, where the keys are (x, y) positions, and the values are candidates. So my program goes along picking numbers from the list of candidates and then propagating the constraints. [...]Basica

Re: Check file is locked?

2009-07-09 Thread Tim Golden
Rajat wrote: I've used the Handle.exe and got the following results: -- notepad.exe pid: 3540 COMP\rajatd C: File (RW-) C:\Documents and Settings\rajatd\Desktop 10: File (RW-) C:\WINDOWS\WinSxS\x86_Microsoft

Re: windows command-line

2009-07-09 Thread Gabriel Genellina
En Wed, 08 Jul 2009 14:23:54 -0300, Emile van Sebille escribió: On 7/8/2009 10:07 AM Lucas Junqueira said... Hi, I'd like to run a simple windows command-line program from within my python script and agt all the returt it generates. Is this possible? How can I do it? Depending on python

Hello

2009-07-09 Thread Tanmoy
Hi ... I have been trying to set this 2-D array of this sort. 0 10 20 ... 1000 1 11 21... 1000 Here is the code i tried ... arr=[] for i in range(0,1010,10): arr.append([]) for j in range(0,1001,1): arr[i].append(i+j) print arr I am getting th

Re: python3 fail to start

2009-07-09 Thread Mark Dickinson
On Jun 30, 3:43 pm, ts wrote: > i just install the python 3.1 dmg onto my mac. when i run python3, it > fail with : > > Fatal Python error: Py_Initialize: can't initialize sys standard > streamsLookupError: unknown encoding: > Abort trap > > couldnt understand the problem. anyone can help? Any ch

Re: Hello

2009-07-09 Thread MRAB
Tanmoy wrote: T Hi ... I have been trying to set this 2-D array of this sort. 0 10 20 ... 1000 1 11 21... 1000 Here is the code i tried ... arr=[] for i in range(0,1010,10): arr.append([]) for j in range(0,1001,1): arr[i].append(i+j)

Re: can i write a assemly language programs in python

2009-07-09 Thread Gabriel Genellina
En Thu, 09 Jul 2009 04:17:52 -0300, m.reddy prasad reddy escribió: can any one tell me how to write assembly language programs in python...if no is there any other way to write the programs in python You write Python programs using Python, not assembly. Perhaps if you provide more info o

subprocess + python-daemon - bug/problem?

2009-07-09 Thread Andy Clegg
Hi all, I'm trying to daemonize a python program, and occasionally have it run subprocesses, however I'm running into a nasty error, as follows: "File "/users/rsg/ancl/devcocast/devcocast-svn/scripts/DaemonSpawnTes t.py", line 5, in subprocess.Popen('echo 1').wait() File "/usr/lib64/python

older pythons

2009-07-09 Thread superpollo
hi everybody. i have a certain set of old python scripts and data used by said scripts which were written using python 2.3 in particular i used some features which were later modified or deprecated by the language newer versions (e.g.: cmp(), print as keyword, and such...) for reasons i fi

hoe to build a patched socketmodule.c

2009-07-09 Thread jacopo mondi
Hi all, I need to patch socketmodule.c (the _socket module) in order to add support to an experimental socket family. I'm guessing about the patched module build process: does a stand alone build script using distutils makes sense, or have I to patch sockmodule.c, eventualy rename it, modify setup

Re: subprocess + python-daemon - bug/problem?

2009-07-09 Thread Andy Clegg
My apologies, the python code should have been: "import daemon import subprocess daemon.DaemonContext(stderr = open("fakeConsole.txt","w+")).open() subprocess.Popen(['echo','1']).wait()" However the error remains the same. Yours, Andy On Jul 9, 10:26 am, Andy Clegg wrote: > Hi all, > > I'm

Re: older pythons

2009-07-09 Thread Adrian Dziubek
The recommended Debian way is update-alternatives. I find it a bit unintuitive, so I have to read through the documentation every time I use it, but it should be able link a chosen version of python to /usr/ bin/python. I don't know if it's set up by default, I have only one version installed. -- A

Re: Check file is locked?

2009-07-09 Thread Rajat
On Jul 9, 1:21 pm, Tim Golden wrote: > Rajat wrote: > > I've used the Handle.exe and got the following results: > > > ---­--- > > notepad.exe pid: 3540 COMP\rajatd > >     C: File  (RW-)   C:\Documents and Settings\rajatd\Desk

Psyco 64 bits

2009-07-09 Thread Luis P. Mendes
Hi, I used Psyco to speed up my Python code. Due to the great amount of data I have to proccess, I moved my Linux system to a 64 bits version with more RAM. It seems that Psyco cannot be used in such platforms. Or is there another version of Psyco for 64 bits platform? I googled and arrived to

Re: can i write a assemly language programs in python

2009-07-09 Thread Tom Kermode
I wonder if the OP is trying to find out whether python programmes can be compiled and run as stand alone executables. (I know assembly and machine code are not the same, but it might be what they're after.) On windows you can use http://www.py2exe.org/ to bundle python programs into stand alone

Re: Check file is locked?

2009-07-09 Thread Tim Golden
Rajat wrote: The Notepad process information is fine here. However, with wordpad the results are not much differentiating: -- wordpad.exe pid: 2832 COMP\rajatd 1C: File (RW-) C:\WINDOWS\WinSxS\x86_Microsoft.Windows

Re: Python-list Digest, Vol 70, Issue 123

2009-07-09 Thread Tanmoy
Hello , When i==0 you append an empty list to arr, so arr[i] is arr[0]. No problem. When i==10 you append another empty list to arr, so arr[i] is arr[10]. Index error because there's no arr[10], only arr[0] and arr[1]. Thanks for your prompt reply... How can i pass this problem Sinc

Re: Python-list Digest, Vol 70, Issue 123

2009-07-09 Thread MRAB
Tanmoy wrote: Hello , When i==0 you append an empty list to arr, so arr[i] is arr[0]. No problem. When i==10 you append another empty list to arr, so arr[i] is arr[10]. Index error because there's no arr[10], only arr[0] and arr[1]. Thanks for your prompt reply... How can i pass t

Re: IP Address Function

2009-07-09 Thread Piet van Oostrum
> Fred Atkinson (FA) wrote: >FA> On Wed, 08 Jul 2009 12:29:54 +0200, Piet van Oostrum >FA> wrote: >>> Something like: >>> >>> #! /usr/bin/env python >>> >>> import cgi >>> from os import getenv >>> >>> print "Content-type: text/html" >>> print >>> >>> ipaddr = (getenv("HTTP_CLIENT_IP")

Re: older pythons

2009-07-09 Thread superpollo
Adrian Dziubek wrote: The recommended Debian way is update-alternatives. I find it a bit unintuitive, so I have to read through the documentation every time I use it, but it should be able link a chosen version of python to /usr/ bin/python. I don't know if it's set up by default, I have only one

Re: Check file is locked?

2009-07-09 Thread Rajat
On Jul 9, 3:21 pm, Tim Golden wrote: > Rajat wrote: > > The Notepad process information is fine here. However, with wordpad > > the results are not much differentiating: > > > ---­--- > > wordpad.exe pid: 2832 COMP\rajatd > >

property using a classmethod

2009-07-09 Thread Emanuele D'Arrigo
Greetings, today I did something like this: class MyClass(object): @classmethod def myClassMethod(self): print "ham" myProperty = property(myClassMethod, None, None) As many of you know this doesn't work and returns a TypeError: the object passed to the property is not a

Re: count

2009-07-09 Thread Bearophile
Paul Rubin: > print x, sum(1 for _ in g) Don't use that, use my function :-) If g has a __len__ you are wasting time. And sum(1 ...) is (on my PC) slower. J. Clifford Dyer: > if __name__ == '__main__': >     test_func(summer, 1000) >     test_func(tupler, 1000) >     test_func(summer, 10

Re: Psyco 64 bits

2009-07-09 Thread Bearophile
Luis P. Mendes: > It seems that Psyco cannot be used in such platforms. > Or is there another version of Psyco for 64 bits platform? > I googled and arrived to PyPy.  But I don't know how to use it. Psyco will be updated, but probably not for 64 bit CPUs. At the moment PyPy doesn't give you much s

python-ldap

2009-07-09 Thread Larry kavanagh
Hi, I need a PYTHON-LDAP package. I'm trying to install ploneldap and it tells me I need python-ldap package first .. but I can't find one to match my versions. I'm using plone 3.2.2, Python 2.4.4 and Zope 2.10.7 on a Win32 environment. Preferable I'd like an EXE as not too familiar with who

Re: older pythons

2009-07-09 Thread Lie Ryan
superpollo wrote: > Adrian Dziubek wrote: >> The recommended Debian way is update-alternatives. I find it a bit >> unintuitive, so I have to read through the documentation every time I >> use it, but it should be able link a chosen version of python to /usr/ >> bin/python. I don't know if it's set

Re: Emacs Python-mode. Newbie problem.

2009-07-09 Thread Piet van Oostrum
> Lacrima (L) wrote: >L> Thanks for your reply! >L> My file name is 'trains.py'. >L> When I do C-h k C-c RET, it shows me help from manual: "C-c RET runs >L> the command py-execute-import-or-reload >L>which is an interactive Lisp function in `python-mode'..." and so >L> on. >L> And still

Re: Pydev 1.4.7 Released

2009-07-09 Thread Fabio Zadrozny
Yes. On Thu, Jul 9, 2009 at 3:32 AM, Morten Nygaard Aasnes wrote: > On 2009-07-08, Fabio Zadrozny wrote: >> Hi All, >> >> Pydev and Pydev Extensions 1.4.7 have been released >> >> Details on Pydev Extensions: http://www.fabioz.com/pydev >> Details on Pydev: http://pydev.sf.net >> Details on its d

Re: older pythons

2009-07-09 Thread superpollo
Lie Ryan wrote: AFAIK, no major linux distributions have officially ported to python 3.x. http://packages.debian.org/experimental/python3.1 thanks for help -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt GUI

2009-07-09 Thread Helvin
On Jul 9, 6:27 pm, Helvin wrote: > On Jul 9, 11:29 am, Robert Kern wrote: > > > > > > > On 2009-07-08 18:10, Helvin wrote: > > > > Thanks for the fast replies! I will look into how to use VTK now. > > > Where would I find VTK's explicit support for PyQt? > > > Wrapping/Python/vtk/qt4/ in the VTK

Re: property using a classmethod

2009-07-09 Thread Bruno Desthuilliers
Emanuele D'Arrigo a écrit : Greetings, today I did something like this: class MyClass(object): @classmethod def myClassMethod(self): Usually, the first argument of classmethods is named 'cls' print "ham" myProperty = property(myClassMethod, None, None) As many of

Particle research opens door for new technology

2009-07-09 Thread Rashid Ali Soomro
Big uses for small particles will be explored at the annual Particle Technology Research Centre Conference at The University of Western Ontario July 9 and 10. for more details on http://0nanotechnology0.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: older pythons

2009-07-09 Thread Lie Ryan
superpollo wrote: > Lie Ryan wrote: > >> AFAIK, no major linux distributions have officially ported to python >> 3.x. > > http://packages.debian.org/experimental/python3.1 > > thanks for help Note the word "experimental" -- http://mail.python.org/mailman/listinfo/python-list

Re: python-ldap

2009-07-09 Thread Michael Ströder
Larry kavanagh wrote: > I need a PYTHON-LDAP package. > > I'm trying to install ploneldap and it tells me I need python-ldap > package first .. but I can't find one to match my versions. > > I'm using plone 3.2.2, Python 2.4.4 and Zope 2.10.7 on a Win32 environment. Did you check all the links

Re: OT: unix to Windows technology

2009-07-09 Thread Xah Lee
a fried showed me this today: http://xahlee.org/funny/Microsoft_eula.html not sure which site originally reported it. Xah ∑ http://xahlee.org/ ☄ -- http://mail.python.org/mailman/listinfo/python-list

Re: older pythons

2009-07-09 Thread superpollo
Lie Ryan wrote: superpollo wrote: Lie Ryan wrote: AFAIK, no major linux distributions have officially ported to python 3.x. http://packages.debian.org/experimental/python3.1 thanks for help Note the word "experimental" i noticed. isn't experimental official? i thought it was... than

Re: older pythons

2009-07-09 Thread Marco Mariani
superpollo wrote: what i was asking for is about a way to *INSTALL* and mantain different python versions, a task i think is not unusal for developers. Check out virtualenv, I ask myself how I could work without it. http://pypi.python.org/pypi/virtualenv -- http://mail.python.org/mailman/lis

Re: property using a classmethod

2009-07-09 Thread Lie Ryan
Emanuele D'Arrigo wrote: > Greetings, > > today I did something like this: > > class MyClass(object): > > @classmethod > def myClassMethod(self): > print "ham" > > myProperty = property(myClassMethod, None, None) > > As many of you know this doesn't work and returns a Typ

Hello

2009-07-09 Thread Tanmoy
> > Hello , > When i==0 you append an empty list to arr, so arr[i] is arr[0]. No > problem. > > When i==10 you append another empty list to arr, so arr[i] is arr[10]. > Index error because there's no arr[10], only arr[0] and arr[1]. > > Thanks for your prompt reply... > > How can i pass th

Re: function local namespace question

2009-07-09 Thread Dave Angel
Paul LaFollette wrote: Kind people, Using Python 3.1 under FreeBSD and WinXP. I've been tearing my hair out trying to solve this myself, but I need to ask for help. I want (for obscure reasons) to be able to log transactions in the namespace(s) of a script. Specifically I would like to log c

Re: function local namespace question

2009-07-09 Thread Diez B. Roggisch
Dave Angel wrote: > Paul LaFollette wrote: >> Kind people, >> >> Using Python 3.1 under FreeBSD and WinXP. >> >> I've been tearing my hair out trying to solve this myself, but I need >> to ask for help. I want (for obscure reasons) to be able to log >> transactions in the namespace(s) of a scrip

Re: property using a classmethod

2009-07-09 Thread Bruno Desthuilliers
Lie Ryan a écrit : Emanuele D'Arrigo wrote: (snip) Ultimately all I want is a non-callable class-level attribute MyClass.myProperty that gives the result of MyClass.myClassMethod(). This works like what you seem to want (it's ugly): Ugly, indeed. And an extreme case of arbitrary overcomplex

Re: older pythons

2009-07-09 Thread superpollo
Marco Mariani wrote: superpollo wrote: what i was asking for is about a way to *INSTALL* and mantain different python versions, a task i think is not unusal for developers. Check out virtualenv, I ask myself how I could work without it. http://pypi.python.org/pypi/virtualenv much obliged

Re: Catching control-C

2009-07-09 Thread Lie Ryan
Michael Mossey wrote: > On Jul 6, 2:47 pm, Philip Semanchuk wrote: >> On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: >> >>> What is required in a python program to make sure it catches a >>> control- >>> c on the command-line? Do some i/o? The OS here is Linux. >> You can use a try/except to

Re: Hello

2009-07-09 Thread MRAB
Tanmoy wrote: Hello , When i==0 you append an empty list to arr, so arr[i] is arr[0]. No problem. When i==10 you append another empty list to arr, so arr[i] is arr[10]. Index error because there's no arr[10], only arr[0] and arr[1]. Thanks for your prom

Re: tough-to-explain Python

2009-07-09 Thread Dave Angel
greg wrote: Dave Angel wrote: By the time I graduated, I had five six-level languages ^^^ Are they languages that you have to edit using vi? :-) Back then I didn't need glasses. That was of course intended to be "six high-level languages" -- http://

Re: Emacs Python-mode. Newbie problem.

2009-07-09 Thread Lacrima
On Jul 9, 2:31 pm, Piet van Oostrum wrote: > > Lacrima (L) wrote: > >L> Thanks for your reply! > >L> My file name is 'trains.py'. > >L> When I do C-h k C-c RET, it shows me help from manual: "C-c RET runs > >L> the command py-execute-import-or-reload > >L>    which is an interactive Lisp func

Re: can i write a assemly language programs in python

2009-07-09 Thread Dave Angel
m.reddy prasad reddy wrote: can any one tell me how to write assembly language programs in python...if no is there any other way to write the programs in python Reddi prasad reddy ph.no:09958083797 Assembly language is a different programming language than Python. You can use both in the s

gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Nick
I've seen a lot of posts on this problem, but none seems to help. Here is the code: /code file = open(prefix1) text = file.readlines() len = len(text) fields = text[1].split() num_rows = int(fields[1]) num_cols = int(fields[2]) U1_matrix = [] print fields print repr(fields) print len(fields) fo

Re: tough-to-explain Python

2009-07-09 Thread Benjamin Kaplan
On Thu, Jul 9, 2009 at 1:05 AM, Simon Forman wrote: > Everyone gets so caught up in programming via languages that > you get, well, people trying to teach "Computer Programming" as if it > were only necessary to grok a language, rather than grokking /symbol > manipulation/ itself. > > +1 QOTW. I'

Blocking XMPP API?

2009-07-09 Thread Gabriel Rossetti
Hello everyone, I am looking for blocking XMPP API. I'm wanting to make a webservice that uses XMPP, but all the XMPP libs I find are non-blocking (i.e. w/ callbacks). I'd like to be able to do something like : cl = Client("t...@domain.com/res01", "password",) msg = "any ideas? Using Java I h

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Lutz Horn
Hi, Nick schrieb: > I've seen a lot of posts on this problem, but none seems to help. Could you please post a sample input file and the exact error message? Thanks Lutz -- Strike Out ⇒ http://www.fourmilab.ch/documents/strikeout -- http://mail.python.org/mailman/listinfo/python-list

Re: older pythons

2009-07-09 Thread Benjamin Kaplan
On Thu, Jul 9, 2009 at 8:10 AM, Lie Ryan wrote: > superpollo wrote: >> Lie Ryan wrote: >> >>> AFAIK, no major linux distributions have officially ported to python >>> 3.x. >> >> http://packages.debian.org/experimental/python3.1 >> >> thanks for help > > Note the word "experimental" Assuming that D

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Friðrik Már Jónsson
Look at: len = len(text) You're overriding `len` (a built-in method), with an integer (`len(text)`). You then call: for i in range(len(fields)): But `len` is no longer a callable, but merely an integer. Regards, Friðrik Már P.S. While this is a fairly obvious problem it's usually a g

Re: Check file is locked?

2009-07-09 Thread Gabriel Genellina
En Thu, 09 Jul 2009 07:53:29 -0300, Rajat escribió: Thanks Tim for the details. Just further on this, my whole idea is to close the wordpad / notepad application so that I can delete the file and the directory where this file resides. With notepad it is no more a problem. But I'm concerned a

Re: Hello

2009-07-09 Thread Dave Angel
You could pick a much better title. And apparently you started a new thread with this one. When responding to an existing message, you ought to reply-all to the existing message, rather than starting a new thread. Tanmoy wrote: Hello , When i==0 you append an empty list to arr, so a

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Richard Brodie
"Nick" wrote in message news:e54c4461-c0b7-42fb-8542-cefd7bf5f...@h18g2000yqj.googlegroups.com... > file = open(prefix1) > text = file.readlines() > len = len(text) You have redefined two built-in functions "file" and "len" in the first three lines. This is usually considered poor practice. S

Re: a little wsgi framework

2009-07-09 Thread timmyt
On Jul 7, 5:19 am, Bruno Desthuilliers wrote: > timmyt a écrit : > > > i'm interested in getting opinions on a smallwsgiframework i > > assembled from webob, sqlalchemy, genshi, and various code fragments i > > found on the inter-tubes > > > here is the interesting glue - any comments / suggestion

Problem with two instances of PySerial

2009-07-09 Thread Shine Jose
Hello friends,I am developing an application to read data from serial port and display it on the screen using GUI developed in pyQT. For this I have instantiated the GUI as well as pySerial objects in the main thread. I have provided a button 'Read' which when clicked by the user reads from the ser

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Nick
On Jul 9, 10:02 am, "Richard Brodie" wrote: > "Nick" wrote in message > > news:e54c4461-c0b7-42fb-8542-cefd7bf5f...@h18g2000yqj.googlegroups.com... > > > file = open(prefix1) > > text = file.readlines() > > len = len(text) > > You have redefined two built-in functions "file" and "len" in the firs

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Bruno Desthuilliers
Nick a écrit : I've seen a lot of posts on this problem, but none seems to help. Here is the code: /code file = open(prefix1) shadows the builtin 'file' type. text = file.readlines() len = len(text) shadows the builtin 'len' function. fields = text[1].split() num_rows = int(fields[1]) n

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Dave Angel
Nick wrote: I've seen a lot of posts on this problem, but none seems to help. Here is the code: /code file = open(prefix1) text = file.readlines() len = len(text) fields = text[1].split() num_rows = int(fields[1]) num_cols = int(fields[2]) U1_matrix = [] print fields print repr(fields) print l

Re: count

2009-07-09 Thread J. Cliff Dyer
Bearophile wins! (This only times the loop itself. It doesn't check for __len__) summer:5 0:00:00.51 bearophile:5 0:00:00.09 summer:50 0:00:00.30 bearophile:50 0:00:00.13 summer:500 0:00:00.77 bearophile:500 0:00:00.53 summer:5000 0:00:00.000575 bearophile:5000 0:00:00.00

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Friðrik Már Jónsson
Previously, I wrote: P.S. While this is a fairly obvious problem it's usually a good idea to post working code and a traceback when requesting help. Nick wrote: thanks for spotting the obvious errors, its my 2nd day programming python in about 3 years. I'm sorry, my saying it was obvious ma

Re: PyQt GUI

2009-07-09 Thread Robert Kern
On 2009-07-09 01:27, Helvin wrote: On Jul 9, 11:29 am, Robert Kern wrote: On 2009-07-08 18:10, Helvin wrote: Thanks for the fast replies! I will look into how to use VTK now. Where would I find VTK's explicit support for PyQt? Wrapping/Python/vtk/qt4/ in the VTK sources. Because I have ins

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Nick
no problem, i understand, i haven't coded anything in literally 2 years, but it was a simple and pretty obvious mistake. thanks for all your help, nick On Jul 9, 11:30 am, Friðrik Már Jónsson wrote: > Previously, I wrote: > >> P.S. While this is a fairly obvious problem it's usually a good > >

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Tom Kermode
Hi, Do you know a good way to avoid running into this problem? It makes sense to suggest not calling variables the same names as built-in functions, but that's hard for a new python programmer who doesn't already know what all the built-in functions are. Over time a programmer will learn which

Re: tkinter problem

2009-07-09 Thread Paul Simon
"Peter Otten" <__pete...@web.de> wrote in message news:h3481q$d95$0...@news.t-online.com... > Paul Simon wrote: > >> "Chris Rebert" wrote in message >> news:mailman.2863.1247095339.8015.python-l...@python.org... >> On Wed, Jul 8, 2009 at 4:18 PM, Paul Simon wrote: >>> I have the "tkinter" proble

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Richard Brodie
"Tom Kermode" wrote in message news:mailman.2903.1247155607.8015.python-l...@python.org... > Do you know a good way to avoid running into this problem? It > makes sense to suggest not calling variables the same names as > built-in functions, but that's hard for a new python programmer who > do

send keys to focused window

2009-07-09 Thread Broken
Hi, I am new to Python, and I'm miserably failing to send specific keys to (say) notepad. Here is the scenario: I have notepad open. My python script is running in the background. When I press ALT+a I want to intercept the keys and send "ä"(ASCII code: ALT+0228) instead. OS: Windows 7 Libraries

Running a script to build docs from setup.py

2009-07-09 Thread Tony Houghton
I want to write a setup.py script, using distutils, for a python library called ROX-Lib2 (package name "rox"). The library includes a script to build HTML documentation from the pydoc strings. I'd like to run that script from setup.py but I don't know the best way to do that. I've looked through th

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Friðrik Már Jónsson
Tom Kermode wrote: Do you know a good way to avoid running into this problem? It makes sense to suggest not calling variables the same names as built-in functions, but that's hard for a new python programmer who doesn't already know what all the built-in functions are. One way is using a code

Re: tkinter problem

2009-07-09 Thread Peter Otten
Paul Simon wrote: > > "Peter Otten" <__pete...@web.de> wrote in message > news:h3481q$d95$0...@news.t-online.com... >> Paul Simon wrote: >> >>> "Chris Rebert" wrote in message >>> news:mailman.2863.1247095339.8015.python-l...@python.org... >>> On Wed, Jul 8, 2009 at 4:18 PM, Paul Simon wrote: >>

Examples of Python driven Microsoft UI Automation wanted

2009-07-09 Thread TheSeeker
Hi, I am embarking on teaching myself Microsoft UI Automation using Python as the scripting language. I have asked some questions in the IronPython users group, but have yet to get a response, so I thought I would broaden the audience by asking here. Specifically, I have a WinForms application I

Re: Opening a SQLite database in readonly mode

2009-07-09 Thread Joshua Kugler
Joshua Kugler wrote: > Sorry about that...since pysqlite and APSW are both discusses on the > pysqlite list, I had made an incorrect assumption. Oops. "are both discusses?" Yeef, I must have been out of it. Discussed, thank you. :) j -- http://mail.python.org/mailman/listinfo/python-list

Re: tough-to-explain Python

2009-07-09 Thread Steven D'Aprano
On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: > The core abstractions of [mechanical] computation are just not that > complicated. You can teach them to anybody in about a half an hour, > drunk. I have. That's *easy*. Anyone can teach the most complicated and abstract principles of an

Re: Examples of Python driven Microsoft UI Automation wanted

2009-07-09 Thread Tim Harig
On 2009-07-09, TheSeeker wrote: > Specifically, I have a WinForms application I will be wanting to > automate. Does anyone have some Python examples of driving Microsoft > UI Automation they could share with me to get me started? The > structure of the UI automation classes etc. seem quite convolu

Re: Cleaning up after failing to contructing objects

2009-07-09 Thread Lie Ryan
brasse wrote: > Hello! > I have been thinking about how write exception safe constructors in > Python. By exception safe I mean a constructor that does not leak > resources when an exception is raised within it. The following is an > example of one possible way to do it: First, your automatic clea

Concatenating images (numpy arrays), but they look like HSV images

2009-07-09 Thread Sebastian Schabe
Hello everybody, I want to concatenate 2 numpy array which in fact are RGB images: def concat_images(im1,im2): rows1 = im1.shape[0] rows2 = im2.shape[0] if rows1 < rows2: im1 = concatenate((im1,zeros((rows2-rows1,im1.shape[1],3), int)), axis=0) elif rows1 > rows2: im2 = concat

Re: property using a classmethod

2009-07-09 Thread Scott David Daniels
Emanuele D'Arrigo wrote: class MyClass(object): @classmethod def myClassMethod(self): print "ham" myProperty = property(myClassMethod, None, None) ... doesn't work and returns a TypeError: So, how do I do this? Ultimately all I want is a non-callable class-level attrib

Re: property using a classmethod

2009-07-09 Thread Lie Ryan
Bruno Desthuilliers wrote: > Lie Ryan a écrit : >> Emanuele D'Arrigo wrote: > (snip) >>> Ultimately all I want is a non-callable class-level attribute >>> MyClass.myProperty that gives the result of MyClass.myClassMethod(). >> >> This works like what you seem to want (it's ugly): > > Ugly, indeed.

Re: Examples of Python driven Microsoft UI Automation wanted

2009-07-09 Thread DuaneKaufman
On Jul 9, 12:18 pm, Tim Harig wrote: > On 2009-07-09, TheSeeker wrote: > > > Specifically, I have a WinForms application I will be wanting to > > automate. Does anyone have some Python examples of driving Microsoft > > UI Automation they could share with me to get me started? The > > structure of

Re: can i write a assemly language programs in python

2009-07-09 Thread Terry Reedy
Dave Angel wrote: m.reddy prasad reddy wrote: can any one tell me how to write assembly language programs in python...if no is there any other way to write the programs in python Reddi prasad reddy ph.no:09958083797 Assembly language is a different programming language than Python. You c

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Rhodri James
On Thu, 09 Jul 2009 17:06:45 +0100, Tom Kermode wrote: Hi, Do you know a good way to avoid running into this problem? It makes sense to suggest not calling variables the same names as built-in functions, but that's hard for a new python programmer who doesn't already know what all the buil

Re: older pythons

2009-07-09 Thread Lie Ryan
superpollo wrote: > Lie Ryan wrote: >> superpollo wrote: >> >>> Lie Ryan wrote: >>> >>> AFAIK, no major linux distributions have officially ported to python 3.x. >>> >>> http://packages.debian.org/experimental/python3.1 >>> >> Note the word "experimental" > > i noticed. isn't experimenta

Re: Emacs Python-mode. Newbie problem.

2009-07-09 Thread Piet van Oostrum
> Lacrima (L) wrote: >L> Thank you for really useful and detailed explanation. Now I can test >L> my code using Emacs. >L> But I think it works for me in a little bit different way. >L> My file contains only the print 'hello world'. >L> If I have no python shell running, then: >L> a) C-c RET

Re: tkinter problem

2009-07-09 Thread Terry Reedy
Paul Simon wrote: "Peter Otten" <__pete...@web.de> wrote in message news:h3481q$d95$0...@news.t-online.com... Paul Simon wrote: I"m using Mandriva 2008.1. I have to tell you honestly that I'm not sure exactly how I installed Python. Originally I had installed 2.5 from RPM but 2.6 was not a

Colour of output text

2009-07-09 Thread Alex Rosslyn
Hi, I would like to learn a way of changing the colour of a particular part of the output text. I've tried the following: import os os.system("color 17") print "This should be white on blue" But that command changes the colour of ALL the text and the whole background. What i'm trying to do is si

Re: Examples of Python driven Microsoft UI Automation wanted

2009-07-09 Thread Tim Harig
On 2009-07-09, DuaneKaufman wrote: > On Jul 9, 12:18 pm, Tim Harig wrote: >> On 2009-07-09, TheSeeker wrote: >> > Specifically, I have a WinForms application I will be wanting to >> > automate. Does anyone have some Python examples of driving Microsoft >> > UI Automation they could share with me

  1   2   >