Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-27 Thread Phil Thompson
On Tuesday 27 February 2007 11:09 pm, shredwheat wrote: > When your programs stops with the error, it should also be printing a > stack trace. This is a list of all the functions that have been called > when Python had the problem. > > You shouldn't have to do anything extra to get the stack trace.

Re: database without installation again

2007-02-27 Thread [EMAIL PROTECTED]
On 28 fév, 00:06, "andrew_s" <[EMAIL PROTECTED]> wrote: > Hi! > > I'm looking for any database which I could use without need of instalation. > I've read some threads here but I couldn't find any complete answer. > On my ISP's server I can use Python throu cgi only. There is Python 2.4.3 > and it h

Re: [OT] python notation in new NVIDIA architecture

2007-02-27 Thread Tim Roberts
"Daniel Nogradi" <[EMAIL PROTECTED]> wrote: >Something funny: > >The new programming model of NVIDIA GPU's is called CUDA and I've >noticed that they use the same __special__ notation for certain things >as does python. For instance their modified C language has identifiers >such as __device__, __

Re: Changing directories in oswalk [was Re: Walk thru each subdirectory from a top directory]

2007-02-27 Thread Peter Otten
Steven D'Aprano wrote: > On Tue, 27 Feb 2007 20:31:43 -0800, Scott David Daniels wrote: > >>> def findallfiles(self, base): >>> self.results = [] >>> for root,dirs,files in os.walk(base): >>> os.chdir(root) >>^^^ Mistake here, don't change directories durin

Re: Yet another unique() function...

2007-02-27 Thread bearophileHUGS
MonkeeSage: > Here's yet another take on a unique() function for sequences. It's > more terse than others I've seen and works for all the common use > cases (please report any errors on the recipe page): It's more terse, but my version is built to be faster in the more common cases of all hashable

Re: Yet another unique() function...

2007-02-27 Thread Paul Rubin
"Paul McGuire" <[EMAIL PROTECTED]> writes: > Any reason not to use a set for the 'seen' variable? Yes, the sequence can contain non-hashable elements. See the test vectors for examples. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, Embedded linux and web development

2007-02-27 Thread Tzury
On Feb 27, 2:27 pm, "Paul Boddie" <[EMAIL PROTECTED]> wrote: > On 27 Feb, 13:12, "Tzury" <[EMAIL PROTECTED]> wrote: > > > > > c) small web application that will be used as front end to configure > > the system (flat files and sqlite3 db are the back-end). > > > Our platform is base on the Intel PXA

Re: Installing java2python (Newbie)

2007-02-27 Thread Troy Melhase
> properly now (error free!! yay) and the j2py script is located under : > C:\Documents and Settings\Ujjal Pathak\Desktop\java2python-0.2\build > \scripts-2.5 that doesn't look right -- it looks like you found what the setup script left behind. what you should look for is j2py in either (a) your

Re: Walk thru each subdirectory from a top directory

2007-02-27 Thread Steven D'Aprano
On Tue, 27 Feb 2007 06:22:51 +, Dennis Lee Bieber wrote: [snip 350-odd file names] > Just a sample of the start of a very long listing... Thanks for sharing. What's with the nude ferret? -- Steven D'Aprano -- http://mail.python.org/mailman/listinfo/python-list

Re: Yet another unique() function...

2007-02-27 Thread Paul McGuire
On Feb 27, 8:55 pm, Paul Rubin wrote: > Paul Rubin writes: > > def unique(seq, keepstr=True): > > t = type(seq) > > if t==str: > > t = (list, ''.join)[bool(keepstr)] > > seen = [] > > return t(c for c in seq if (c not in

Re: Installing java2python (Newbie)

2007-02-27 Thread [EMAIL PROTECTED]
This is my friend's computer, BTW! -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing java2python (Newbie)

2007-02-27 Thread [EMAIL PROTECTED]
Hi Troy, once again thanks for the quickie. I installed everything properly now (error free!! yay) and the j2py script is located under : C:\Documents and Settings\Ujjal Pathak\Desktop\java2python-0.2\build \scripts-2.5 Meaning under scripts-2.5 folder, there are two files j2py and jast_print but

Re: f2py and Fortran90 gfortran_filename error

2007-02-27 Thread Robert Kern
Tyler wrote: > Hello All: > > Since my last post I have attempted to use the f2py program which > comes with numpy. It's better to ask these questions on numpy-discussion, instead. There are more f2py users per capita there. http://www.scipy.org/Mailing_Lists > I am able to create a .so file

Re: Running Python scripts from BASH

2007-02-27 Thread Ross Ridge
Ishpeck <[EMAIL PROTECTED]> wrote: >': [Errno 22] Invalid argumentopen file 'foo.py The problem is that Python is using the standard Windows CRLF line endings, while Cygwin bash expects Unix LF-only line endings. Your script ends up trying run the script "foo.y\r" instead of "foo.y", and since CR

Re: Installing java2python (Newbie)

2007-02-27 Thread [EMAIL PROTECTED]
> Hi Jeremy, that's the problem I'm having. Where should I type that " > python setup.py install" ? Once again I'm using Windows system and not > Unix. Should I move the file to a specific folder under Python 2.5 and > then type " python setup.py install" in IDLE or Command Line window? > I get th

Changing directories in oswalk [was Re: Walk thru each subdirectory from a top directory]

2007-02-27 Thread Steven D'Aprano
On Tue, 27 Feb 2007 20:31:43 -0800, Scott David Daniels wrote: >> def findallfiles(self, base): >> self.results = [] >> for root,dirs,files in os.walk(base): >> os.chdir(root) >^^^ Mistake here, don't change directories during os.walk ^^^ I came across this

f2py and Fortran90 gfortran_filename error

2007-02-27 Thread Tyler
Hello All: Since my last post I have attempted to use the f2py program which comes with numpy. I am able to create a .so file fine; however, when I import it into Python, I receive the following message: >>> import matsolve2 Traceback (most recent call last): File "", line 1, in ? ImportError

Re: Installing java2python (Newbie)

2007-02-27 Thread Jeremy Dillworth
You'll need to run the command in the command-line window. If you're unfamiliar, here's how to start it up: Click "Start" then "Run..." then type "Cmd" in the open field. Click OK. Once you're at the command line there will be a little variation depending on where things are located on your PC.

Re: PyCon blogs?

2007-02-27 Thread johnf
[EMAIL PROTECTED] wrote: > Was anybody blogging about PyCon (talks and/or sprints)? Got any > pointers? > > Thanks, > > Skip At least one session was posted on YouTube http://dabodev.com/pycon2007 Johnf -- http://mail.python.org/mailman/listinfo/python-list

Re: What is bad with "Relative imports"

2007-02-27 Thread Aahz
In article <[EMAIL PROTECTED]>, Alexander Eisenhuth <[EMAIL PROTECTED]> wrote: > >PyLint says that "Relative imports" ... are worth to be warned . > >And I ask myself why? http://www.python.org/dev/peps/pep-0328 -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "I di

Re: Installing java2python (Newbie)

2007-02-27 Thread [EMAIL PROTECTED]
Hi Jeremy, that's the problem I'm having. Where should I type that " python setup.py install" ? Once again I'm using Windows system and not Unix. Should I move the file to a specific folder under Python 2.5 and then type " python setup.py install" in IDLE or Command Line window? I get the error "S

[ANN] mlabrap-1.0b: a high level python to matlab bridge

2007-02-27 Thread Alexander Schmolck
URL --- Description --- Mlabwrap-1.0 is a high-level python to matlab(tm) bridge that makes calling matlab functions from python almost as convenient as using a normal python library. It is available under a very liberal license (BSD/MIT) and should work

Re: Installing java2python (Newbie)

2007-02-27 Thread Jeremy Dillworth
I haven't used that particular package, but the norm for setup.py is this command line: python setup.py install Hope this helps, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: Walk thru each subdirectory from a top directory

2007-02-27 Thread Scott David Daniels
Adam wrote: > On Feb 26, 9:28 pm, [EMAIL PROTECTED] wrote: >> i am trying to use python to walk thru each subdirectory from a top >> directory. Here is my script: > > This bit below is from one of my first programs as I'm currently > learning. It is designed to go form the root down and retu

Installing java2python (Newbie)

2007-02-27 Thread loveline17
Hi guys, I'm having a hard time installing java2python ( http://code.google.com/p/java2python/ ) on my Windows XP 32-bit machine. I double click setup.py but nothing happens. Is there any specific Python sub-folder where I should put it and install using command line? Even when I use command-line,

Re: boolean flag vs threading.Event

2007-02-27 Thread Daniel
> But what are you gaining, really [by using a boolean flag instead of an > Event]? I agree Chris, the Event is better and it certainly does not add much if any overhead. Thanks for the response. ~ Daniel -- http://mail.python.org/mailman/listinfo/python-list

PyFit documentation

2007-02-27 Thread David Brochu
I am trying to run some testing using Fitnesse with the PyFit python module. For some reason I am not able to import the fit.ColumnFixture module from PyFit. I use the following command: from fit.ColumnFixture import ColumnFixture I can't find any documentation on the web for PyFit syntax. Anyon

Re: Yet another unique() function...

2007-02-27 Thread MonkeeSage
On Feb 27, 9:03 pm, "MonkeeSage" <[EMAIL PROTECTED]> wrote: > On Feb 27, 8:55 pm, Paul Rubin wrote: > > > > > Paul Rubin writes: > > > def unique(seq, keepstr=True): > > > t = type(seq) > > > if t==str: > > > t = (list, ''.join)[

Re: Yet another unique() function...

2007-02-27 Thread MonkeeSage
On Feb 27, 8:55 pm, Paul Rubin wrote: > Paul Rubin writes: > > def unique(seq, keepstr=True): > > t = type(seq) > > if t==str: > > t = (list, ''.join)[bool(keepstr)] > > seen = [] > > return t(c for c in seq if (c not in

Re: Yet another unique() function...

2007-02-27 Thread Paul Rubin
Paul Rubin writes: > def unique(seq, keepstr=True): > t = type(seq) > if t==str: > t = (list, ''.join)[bool(keepstr)] > seen = [] > return t(c for c in seq if (c not in seen, seen.append(c))[0]) Preferable: def unique(seq, keepstr=True): t =

Re: Yet another unique() function...

2007-02-27 Thread Paul Rubin
"MonkeeSage" <[EMAIL PROTECTED]> writes: > Here's yet another take on a unique() function for sequences. It's > more terse than others I've seen and works for all the common use > cases (please report any errors on the recipe page): > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/50226

Py2EXE problem

2007-02-27 Thread Sick Monkey
Maybe this is not the board to post this, but hopefully with all of the python experts out there maybe one of you have encountered this. I wrote an application that sends an email with an attachment. When I run it, it runs great with no issues what-so--ever. When I thought I was finally finish

Re: design question: no new attributes

2007-02-27 Thread Steven D'Aprano
On Tue, 27 Feb 2007 20:59:03 +, Alan Isaac wrote: > "Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > class Difficult(object): > def __setattr__(self, name, value): > if self.__dict__.has_key(name): > print "'%s' exists as an instance att

Re: how to convert an integer to a float?

2007-02-27 Thread Ben Finney
Please don't top-post; instead, reply below the lines you're responding to, and trim any irrelevant lines from the original. Subscriber123 <[EMAIL PROTECTED]> writes: > How did the new division ever get approved?! By being introduced as a PEP, which is now numbered PEP 238. http://www.pytho

Re: threading a thread

2007-02-27 Thread tubby
Bjoern Schliessmann wrote: > RTFM? One last things... here's a *very* small sample netstat output from a threaded py script: > tcp0 1 192.168.1.100:41066 192.168.17.132:www SYN_SENT > tcp0 1 192.168.1.100:46412 192.168.5.132:www SYN_SENT > tcp

Yet another unique() function...

2007-02-27 Thread MonkeeSage
Here's yet another take on a unique() function for sequences. It's more terse than others I've seen and works for all the common use cases (please report any errors on the recipe page): http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502263 Regards, Jordan -- http://mail.python.org/mail

Re: threading a thread

2007-02-27 Thread tubby
Bjoern Schliessmann wrote: > tubby wrote: > >> Have you tried it? Nmap is sequential. > > RTFM? I urge you to actually try it and see for yourself. From my experience, it sucks... even when only doing 1 port it takes hours regarless of what the man page implies. I'll figure it out, thanks, Tu

Re: how to convert an integer to a float?

2007-02-27 Thread Subscriber123
How did the new division ever get approved?! That's not pythonic! What if you then need to divide two integers and find an element in a list or dict? It will give you an error! I know that at the moment it is not implemented unless imported from __future__, but I expect that it eventually might be

Re: design question: no new attributes

2007-02-27 Thread Ben Finney
"Alan Isaac" <[EMAIL PROTECTED]> writes: > OK, let me approach this from a new direction. Suppose I define a > class that behaves I think as I stipulated:: > > class NothingNew: > a = 0 > def __init__(self): > self.b = 1 > self.initialized = True > def __setattr__(self

Re: Is there a technic to avoid this bug

2007-02-27 Thread Ben Finney
hg <[EMAIL PROTECTED]> writes: > I spent a few hours find this bug: > > value == self.Get_Value() > if value == WHATEVER: >do this > > instead of > value = self.Get_Value() > if value == WHATEVER: >do this > > Is there a way to avoid such a bug with some type of construct ? Use pylint to

Re: Special Characters

2007-02-27 Thread Sick Monkey
Sorry guys. It has been a long day today. There is no issues when dealing with "#" in variables. I found out that when I was reading the file, there were additional blank spaces being appended to the value. To correct the issue, I just had to dp varName = msInfo[0].strip() finName = varN

Re: os.system and quoted strings

2007-02-27 Thread Dan Bishop
On Feb 27, 9:16 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Tue, 27 Feb 2007 06:24:41 -0800, svata wrote: ... > > import time > > import os > > > dir = "C:\\Documents and Settings\\somepath\\" > > I believe that Windows will accept forward slashes as directory > separators, so you can write

Re: design question: no new attributes

2007-02-27 Thread Alan Isaac
OK, let me approach this from a new direction. Suppose I define a class that behaves I think as I stipulated:: class NothingNew: a = 0 def __init__(self): self.b = 1 self.initialized = True def __setattr__(self, attr, val): if not hasattr(self,'initialized') or

Re: Tuples from List

2007-02-27 Thread rshepard
On 2007-02-28, Robert Kern <[EMAIL PROTECTED]> wrote: > No, that's a numpy array. Robert, That's where I went off. I forgot that I'm still dealing with a 1D NumPy array and not a list. No wonder I had such fits! > Those aren't tuples, but complex numbers. I have not seen the 'j' suffix bef

Re: Is there a technic to avoid this bug

2007-02-27 Thread John J. Lee
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > hg wrote: [...] > > In a relatively similar domain, I spent a few hours find this bug: > > > > value == self.Get_Value() > > if value == WHATEVER: > >do this > > > > instead of > > value = self.Get_Value() > > if value == WHATEVER: > >do t

Re: Tuples from List

2007-02-27 Thread Paul Rubin
[EMAIL PROTECTED] writes: > [ 6.24249034e-01+0.j 5.11335982e-01+0.j 3.67333773e-01+0.j >3.01189122e-01+0.j 2.43449050e-01+0.j 1.82948476e-01+0.j >1.43655139e-01+0.j 9.91225725e-02+0.j] > > and I want a list of floats of only the first 6 digits for each value. If I > write: >

Python, SOAP & SSL

2007-02-27 Thread Barker, CJ
Was this ever solved? I'm running into the same problem right now. Any help is much appreciated. -cjb -- http://mail.python.org/mailman/listinfo/python-list

Special Characters

2007-02-27 Thread Sick Monkey
I have a quick question about handling values with special characters. Lets say I have a file which contains: == blah#blah == Here is what I have for my code: f6 = open(fileAttached) msInfo = f6.readlines(); f6.close() varNam

Re: Tuples from List

2007-02-27 Thread Ben Finney
[EMAIL PROTECTED] writes: > While it should be easy for me to get what I need from a list, it's > proving to be more difficult than I expected. > > I start with this list: > > [ 6.24249034e-01+0.j 5.11335982e-01+0.j 3.67333773e-01+0.j >3.01189122e-01+0.j 2.43449050e-01+0.j 1.82948

Re: Tuples from List

2007-02-27 Thread Robert Kern
[EMAIL PROTECTED] wrote: > While it should be easy for me to get what I need from a list, it's > proving to be more difficult than I expected. > > I start with this list: > > [ 6.24249034e-01+0.j 5.11335982e-01+0.j 3.67333773e-01+0.j >3.01189122e-01+0.j 2.43449050e-01+0.j 1.82948

Re: import parent

2007-02-27 Thread Gary Herron
[EMAIL PROTECTED] wrote: > How does one get access to the class that imported a module. For example: > foo imports bar -- how does bar access foo? > > Thanks. > > If bar wants to access foo, it just imports it. If foo imports bar as well, then you have circular imports, but Python can handle

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 3:47 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Andrew Felch wrote: > > Thanks for checking. I think I narrowed the problem down to > > inheritance. I inherit from list or some other container first: > > > class PointList( list, AutoReloader ): > > def PrintHi1(self): > >

Tuples from List

2007-02-27 Thread rshepard
While it should be easy for me to get what I need from a list, it's proving to be more difficult than I expected. I start with this list: [ 6.24249034e-01+0.j 5.11335982e-01+0.j 3.67333773e-01+0.j 3.01189122e-01+0.j 2.43449050e-01+0.j 1.82948476e-01+0.j 1.43655139e-01+0.j 9.9

Re: how to convert an integer to a float?

2007-02-27 Thread Grant Edwards
On 2007-02-28, jeff <[EMAIL PROTECTED]> wrote: > On Feb 27, 7:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, >> i1)' always return 0, can you please tell me how can i convert it from >> an integer to float? >> >> def com

Re: Vector, matrix, normalize, rotate. What package?

2007-02-27 Thread James Stroud
Mattias Brändström wrote: > Hello! > > I'm trying to find what package I should use if I want to: > > 1. Create 3d vectors. > 2. Normalize those vectors. > 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in > radians. > 4. Perform matrix multiplication. > > It seems to me tha

PyCon blogs?

2007-02-27 Thread skip
Was anybody blogging about PyCon (talks and/or sprints)? Got any pointers? Thanks, Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: threading a thread

2007-02-27 Thread Bjoern Schliessmann
tubby wrote: > Have you tried it? Nmap is sequential. RTFM? | NMAP(1)Nmap Reference GuideNMAP(1) | [...] | TIMING AND PERFORMANCE | [...] While Nmap utilizes parallelism and many advanced | algorithms to accelerate these scans, the user has ultimate |

Re: how to convert an integer to a float?

2007-02-27 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > def compareValue(n1, n2): > i1 = int(n1) > i2 = int(n2) > > dx = abs(i2 - i1)/min(i2, i1) > print dx > return dx < 0.05 You could also prepend from __future__ import division Regards, Björn -- BOFH excuse #237: Plate voltage too low on demod

Re: how to convert an integer to a float?

2007-02-27 Thread Matimus
On Feb 27, 4:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, > i1)' always return 0, can you please tell me how can i convert it from > an integer to float? > > def compareValue(n1, n2): > i1 = int(n1) > i2 = int(n

Re: how to convert an integer to a float?

2007-02-27 Thread bearophileHUGS
yinglcs, you can use float() or the new division: >>> 1 / 2 0 >>> 1 / float(2) 0.5 >>> from __future__ import division >>> 1 / 2 0.5 Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert an integer to a float?

2007-02-27 Thread Farshid Lashkari
Farshid Lashkari wrote: > When two integers are involved in a division, the result will also be a > division. My bad, I meant the result will also be an *integer* -Farshid -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert an integer to a float?

2007-02-27 Thread Farshid Lashkari
[EMAIL PROTECTED] wrote: > Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, > i1)' always return 0, can you please tell me how can i convert it from > an integer to float? When two integers are involved in a division, the result will also be a division. If one of the operands

Re: Python Source Code Beautifier

2007-02-27 Thread [EMAIL PROTECTED]
On Feb 27, 3:45 am, Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: > Hello, I did not find any reasonable pyhton source code beautifier > program (preferable gui). > > Some would ask why? Program it immediatly good. > > (BTW: Would be a nice project, if I would have more spare time). > > Ich have s

Re: how to convert an integer to a float?

2007-02-27 Thread jeff
On Feb 27, 7:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, > i1)' always return 0, can you please tell me how can i convert it from > an integer to float? > > def compareValue(n1, n2): > i1 = int(n1) > i2 = int(n

how to convert an integer to a float?

2007-02-27 Thread [EMAIL PROTECTED]
Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, i1)' always return 0, can you please tell me how can i convert it from an integer to float? def compareValue(n1, n2): i1 = int(n1) i2 = int(n2) dx = abs(i2 - i1)/min(i2, i1) print dx return dx < 0.05 -- ht

Re: database without installation again

2007-02-27 Thread Ben Finney
"andrew_s" <[EMAIL PROTECTED]> writes: > I'm looking for any database which I could use without need of > instalation. Python 2.5 comes with SQLite built in. SQLite allows database interaction without a corresponding server; all the code is in the client, in this case provided in the Python stand

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: > Thanks for checking. I think I narrowed the problem down to > inheritance. I inherit from list or some other container first: > > class PointList( list, AutoReloader ): > def PrintHi1(self): > print "Hi2" > > class MyPrintingClass( AutoReloader ): > def Prin

Re: Running Python scripts from BASH

2007-02-27 Thread James Stroud
Ishpeck wrote: > I'm using Python to automate testing software for my company. I > wanted the computers in my testing lab to automatically fetch the > latest version of the python scripts from a CVS repository and then > ask a local database server which of the scripts to run. > > I built the fo

Re: Running Python scripts from BASH

2007-02-27 Thread Ben Finney
"Ishpeck" <[EMAIL PROTECTED]> writes: > I'm using Python to automate testing software for my company. I > wanted the computers in my testing lab to automatically fetch the > latest version of the python scripts from a CVS repository and then > ask a local database server which of the scripts to r

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 3:23 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Andrew Felch wrote: > > I pasted the code into mine and replaced the old. It seems not to > > work for either unpickled objects or new objects. I add methods to a > > class that inherits from AutoReloader and reload the module, but

Re: database without installation again

2007-02-27 Thread Larry Bates
andrew_s wrote: > Hi! > > I'm looking for any database which I could use without need of instalation. > I've read some threads here but I couldn't find any complete answer. > On my ISP's server I can use Python throu cgi only. There is Python 2.4.3 > and it has only standard library modules and

Re: import parent

2007-02-27 Thread Larry Bates
Greg Hoover wrote: > How does one get access to the class that imported a module. For example: > foo imports bar -- how does bar access foo? > > Thanks. > I think we are having a problem understanding what you are asking. If you mean an instance of class foo contains an instance of class bar how

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: > I pasted the code into mine and replaced the old. It seems not to > work for either unpickled objects or new objects. I add methods to a > class that inherits from AutoReloader and reload the module, but the > new methods are not callable on the old objects. Man! It seems

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-27 Thread shredwheat
When your programs stops with the error, it should also be printing a stack trace. This is a list of all the functions that have been called when Python had the problem. You shouldn't have to do anything extra to get the stack trace. -- http://mail.python.org/mailman/listinfo/python-list

database without installation again

2007-02-27 Thread andrew_s
Hi! I'm looking for any database which I could use without need of instalation. I've read some threads here but I couldn't find any complete answer. On my ISP's server I can use Python throu cgi only. There is Python 2.4.3 and it has only standard library modules and no possibility to oficially

Re: Vector, matrix, normalize, rotate. What package?

2007-02-27 Thread shredwheat
On Feb 27, 2:49 pm, "Mattias Brändström" <[EMAIL PROTECTED]> wrote: > I'm trying to find what package I should use if I want to: > > 1. Create 3d vectors. > 2. Normalize those vectors. > 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in > radians. > 4. Perform matrix multiplica

Re: Vector, matrix, normalize, rotate. What package?

2007-02-27 Thread Paul Rubin
"Mattias Brändström" <[EMAIL PROTECTED]> writes: > I'm trying to find what package I should use if I want to: > 1. Create 3d vectors. > 2. Normalize those vectors. > 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in > radians. > 4. Perform matrix multiplication. If this is a m

Re: Running Python scripts from BASH

2007-02-27 Thread Ishpeck
It may be worth noting that I'm running Cygwin on WindowsXP professional. -- http://mail.python.org/mailman/listinfo/python-list

Running Python scripts from BASH

2007-02-27 Thread Ishpeck
I'm using Python to automate testing software for my company. I wanted the computers in my testing lab to automatically fetch the latest version of the python scripts from a CVS repository and then ask a local database server which of the scripts to run. I built the following: #!/bin/bash # Bat

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 5:30 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Andrew Felch wrote: > > > Thanks Ziga. I use pickle protocol 2 and binary file types with the > > command: "cPickle.dump(obj, file, 2)" > > > I did your suggestion, i commented out the "__call__" function of > > MetaInstanceTracker

Vector, matrix, normalize, rotate. What package?

2007-02-27 Thread Mattias Brändström
Hello! I'm trying to find what package I should use if I want to: 1. Create 3d vectors. 2. Normalize those vectors. 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in radians. 4. Perform matrix multiplication. It seems to me that perhaps numpy should be able to help me with t

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: > > Thanks Ziga. I use pickle protocol 2 and binary file types with the > command: "cPickle.dump(obj, file, 2)" > > I did your suggestion, i commented out the "__call__" function of > MetaInstanceTracker and copied the text to the __new__ function of > AutoReloader (code append

Re: book for a starter

2007-02-27 Thread Wensui Liu
Thank you all for your wonderful suggestion and advice. Have a great evening! wensui On 27 Feb 2007 12:08:46 -0800, RickMuller <[EMAIL PROTECTED]> wrote: > On Feb 27, 12:08 pm, "Sriram" <[EMAIL PROTECTED]> wrote: > > Hi, > > > > If you have experience programming, just read the online tutorial

Re: design question: no new attributes

2007-02-27 Thread Chris Mellon
On 2/27/07, Alan Isaac <[EMAIL PROTECTED]> wrote: > "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > def __setattr__(self, attr, val): > > if hasattr(self, attr): > > self.__dict__[attr] = val > > else: > > # Tell the user off > > But then

Re: import parent

2007-02-27 Thread Ben Finney
[EMAIL PROTECTED], [EMAIL PROTECTED] writes: > How does one get access to the class that imported a module. For > example: foo imports bar -- how does bar access foo? If bar needs to know something specific from foo, then bar should expose an interface that asks explicitly for that information,

Re: Pixel Array => Bitmap File

2007-02-27 Thread Jason B
My mistake, I see the section now about "Writing Your Own File Decoder..." Thanks again for your help! - J "Jason B" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks, Roel... > > The Image.frombuffer() method looks promising, but the "mode" parameter > seems a bit too limi

Re: Pixel Array => Bitmap File

2007-02-27 Thread Jason B
Thanks, Roel... The Image.frombuffer() method looks promising, but the "mode" parameter seems a bit too limited for my needs. I must be able to specify not only the order of the bits (RGB in any order) but also whether the format is 565, 555, etc. Maybe I need to work outside the bounds of PI

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 3:50 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Andrew Felch wrote: > > Hello all, > > > I'm using the metaclass trick for automatic reloading of class member > > functions, found > > at:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 > > > My problem is that if I

Re: boolean flag vs threading.Event

2007-02-27 Thread Chris Mellon
On 27 Feb 2007 13:37:12 -0800, Daniel <[EMAIL PROTECTED]> wrote: > I have a class similar to this: > > > class MyThread(threading.Thread): > > def __init__(self): > self.terminated = False > > def run(self): > while not self.terminated: > pass # do stuff here > >

Re: Pixel Array => Bitmap File

2007-02-27 Thread Roel Schroeven
Jason B schreef: > Hi all, > > I'm somewhat new to Python and I'm trying to figure out the best way to > accomplish the following: > > From an array of pixel data in an XML file (given the format, width and > height of the image as attributes) I must read in the data and save it off > as a bmp

Re: import parent

2007-02-27 Thread John Machin
On Feb 28, 8:01 am, Greg Hoover wrote: > How does one get access to the class that imported a module. For example: > foo imports bar -- how does bar access foo? It shouldn't (in any language, not just Python). Callees should not in general need to inspect their caller's data structures, and shoul

Pixel Array => Bitmap File

2007-02-27 Thread Jason B
Hi all, I'm somewhat new to Python and I'm trying to figure out the best way to accomplish the following: >From an array of pixel data in an XML file (given the format, width and height of the image as attributes) I must read in the data and save it off as a bmp file. I've gotten the PIL and

Re: threading a thread

2007-02-27 Thread tubby
Bjoern Schliessmann wrote: > tubby wrote: >> Right now I'm just prototyping and the threaded hosts portion >> works very well for my needs. I'd just like to add a threaded >> ports check and wanted to know if anyone had done something >> similar in Python. > > Taken the vast amount of threads you'

Re: gmpy moving to code.google.com

2007-02-27 Thread Ziga Seilnacht
Alex Martelli wrote: > On Feb 27, 2007, at 2:59 AM, Daniel Nogradi wrote: > > > Hi Alex, > > > I did another test, this time with python 2.4 on suse and things are > > worse than in the previous case (which was python 2.5 on fedora 3), > > ouput of 'python gmp_test.py' follows: > > Interesting! gm

boolean flag vs threading.Event

2007-02-27 Thread Daniel
I have a class similar to this: class MyThread(threading.Thread): def __init__(self): self.terminated = False def run(self): while not self.terminated: pass # do stuff here def join(self): self.terminated = True threading.Thread.join(self

Re: Importing WMI in a child Thread throws an error

2007-02-27 Thread Tim Golden
[EMAIL PROTECTED] wrote: > The problem I have is that since I import WMI, it takes a long time > and we have users complaining about it. So I stuck the import > statement into a separate thread and set it to a daemon so it could do > its thing in the background and the rest of the script would fin

Re: threading a thread

2007-02-27 Thread Bjoern Schliessmann
tubby wrote: > Right now I'm just prototyping and the threaded hosts portion > works very well for my needs. I'd just like to add a threaded > ports check and wanted to know if anyone had done something > similar in Python. Taken the vast amount of threads you'll need, there will be a big overhead

Re: import parent

2007-02-27 Thread Bjoern Schliessmann
Greg Hoover wrote: > How does one get access to the class that imported a module. For > example: foo imports bar -- how does bar access foo? Directly? Not at all in sane programs, IMHO. That's the job of clear interfaces. Regards, Björn -- BOFH excuse #407: Route flapping at the NAP. --

Re: design question: no new attributes

2007-02-27 Thread Alan Isaac
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > def __setattr__(self, attr, val): > if hasattr(self, attr): > self.__dict__[attr] = val > else: > # Tell the user off But then you cannot even set attributes during initialization, right? I wan

Re: design question: no new attributes

2007-02-27 Thread Alan Isaac
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] class Difficult(object): def __setattr__(self, name, value): if self.__dict__.has_key(name): print "'%s' exists as an instance attribute" % name self.__dict__[name] = value elif

  1   2   3   >