[ANN] markup.py 1.8

2012-02-18 Thread Daniel Nogradi
A new release of markup.py is available at http://markup.sourceforge.net/ This new release is compatible with both python 2 and 3. What is markup.py? Markup.py is an intuitive, light weight, easy-to-use, customizable and pythonic HTML/XML generator. The only goal is quickly writing HTML/XML segm

ExpatError attributes

2005-11-04 Thread Daniel Nogradi
According to the documentation the xml.parsers.expat module provides the exception ExpatError and this exception has 3 attributes, lineno, offset and code. I would like to use lineno, but can't. ExpatError itself works, for example if I do import sys from xml.dom import minidom from xml.parsers.e

object oriented programming question

2005-12-17 Thread Daniel Nogradi
I have class 'x' with member 'content' and another member  'a'  which is an instance of class '_a'. The class '_a' is callable and has a method 'func' which I would like to use to modify 'content' but I don't know how to address 'content' from the class '_a'. Is it possible? Here is the code that

Re: object oriented programming question

2005-12-18 Thread Daniel Nogradi
Hello Daniel You've certainly got a lot going on here.The heart of your question seems to be how a nested (inner) class _a can access its parent, x.  The short answer is that, in Python, it can't without some help.  _a and its instances are unaware of the context in which they are defined, sothey h

Re: object oriented programming question

2005-12-19 Thread Daniel Nogradi
Hi Michael, one more thing. As you could see my only goal was to be able to say 1  inst = x() 2 3  inst.a("some string") 4  inst.a.func() 5 6  inst.b("some other string") 7  inst.b.func() and (3) should modify 'inst.content' in some way depending on "some string" and the attribute 'a' while (4)

Re: coupling python scripts

2005-12-19 Thread Daniel Nogradi
Hi There!I created a few python scripts and everything is working fine. But to make it easier to run the procedure i want to couple these scripts inone big script. Is there a possibility to do this, can I for examplemake a script dat 'calls' the other script in the right order?Many thanks! Sander

Re: When writing text. . .

2006-07-14 Thread Daniel Nogradi
> Hey I'm pretty new to python and I have a question. I'm trying to write: > "[BOOT] > run=C:\windows\aawin.bat" > > in my win.ini > So I went about it like this: > > win = open('C:\windows\win.ini', 'a') > win.write('[BOOT]') > win.write('\n') > win.write('run=C:\windows\aawin.bat') > > I expecte

instantiate all subclasses of a class

2006-07-16 Thread Daniel Nogradi
What is the simplest way to instantiate all classes that are subclasses of a given class in a module? More precisely I have a module m with some content: # m.py class A: pass class x( A ): pass class y( A ): pass # all kinds of other objects follow # end of m.py and then in another m

Re: instantiate all subclasses of a class

2006-07-16 Thread Daniel Nogradi
> > More precisely I have a module m with some content: > > > > # m.py > > class A: > > pass > > class x( A ): > > pass > > class y( A ): > > pass > > # all kinds of other objects follow > > # end of m.py > > > > and then in another module I have currently: > > > > # n.py > > import m >

Re: instantiate all subclasses of a class

2006-07-16 Thread Daniel Nogradi
> > >>> from inspect import isclass > > >>> > > >>> class x: > > ... def __getattr__( self, attr ): > > ... pass > > ... > > >>> y = x( ) > > >>> isclass( y ) > > True > > Which reinforces Michael Spencer's instinct that the inspect.isclass() > implementation is a bit too clever Wou

Re: instantiate all subclasses of a class

2006-07-16 Thread Daniel Nogradi
> > What is the simplest way to instantiate all classes that are > > subclasses of a given class in a module? > > > > More precisely I have a module m with some content: > > > > # m.py > > class A: > > pass > > class x( A ): > > pass > > class y( A ): > > pass > > # all kinds of other o

Re: Help!

2006-07-17 Thread Daniel Nogradi
> I have a problem with python. When I try to connect to > postgresql. It appears a message. > > ]$ python > > >>> from pg import DB > Traceback (most recent call last): > >File "", line 1, sn? > > ImportError:

Re: CGI Tutorial

2006-10-05 Thread Daniel Nogradi
> I'm just building a Python CGI Tutorial and would appreciate any > feedback from the many experts in this list. > > Regards, Clodoaldo Pinto Neto > Perhaps you want to post this to the mod_python list as well: http://mailman.modpython.org/mailman/listinfo/mod_python -- http://mail.python.org/ma

Re: operator overloading + - / * = etc...

2006-10-07 Thread Daniel Nogradi
> Can these operators be overloaded? > If so. How? > http://www.python.org/doc/ref/numeric-types.html HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Python component model

2006-10-09 Thread Daniel Nogradi
> > Why not propose something. That is the easiest way to get things moving. > > How does one do that ? Propose something here on this NG or is there > some other official way ? I'm by no means an expert here but the usual procedure as far as I can see is this: 1. propose something here and get

Re: How to execute a linux command by python?

2006-10-18 Thread Daniel Nogradi
> > How to execute a linux command by python? > > for example: execute "ls" or "useradd oracle" > > Who can help me? > > start here: > > http://www.python.org/doc/lib/ > And continue here: http://www.python.org/doc/lib/os-process.html -- http://mail.python.org/mailman/listinfo/python-list

lossless transformation of jpeg images

2006-10-29 Thread Daniel Nogradi
Hi all, Last time I checked PIL was not able to apply lossless transformations to jpeg images so I've created Python bindings (or is it a wrapper? I never knew the difference :)) for the jpegtran utility of the Independent Jpeg Group. The jpegtran utility is written in C and is very efficient, fa

Re: lossless transformation of jpeg images

2006-10-29 Thread Daniel Nogradi
> Hi all, > > Last time I checked PIL was not able to apply lossless transformations > to jpeg images so I've created Python bindings (or is it a wrapper? I > never knew the difference :)) for the jpegtran utility of the > Independent Jpeg Group. > > The jpegtran utility is written in C and is very

Re: looping through two list simultenously

2006-10-29 Thread Daniel Nogradi
> folks > I have two lists > > i am trying to loop thorough them simultenously. > > Here is the code i am using [...] > Is there any efficient doing this > Try the zip function: >>> list1 = [ 'a', 'b', 'c' ] >>> list2 = [ 'A', 'B', 'C' ] >>> for i, j in zip( list1, list2 ): ... print i, j

Re: lossless transformation of jpeg images

2006-10-30 Thread Daniel Nogradi
> > > Last time I checked PIL was not able to apply > > > lossless transformations to jpeg images so > > > I've created Python bindings (or is it a > > > wrapper? I never knew the difference :)) for > > > the jpegtran utility of the Independent Jpeg > > > Group. > > > Why not use Tkinter for jpeg ?

Re: Lists of lists and tuples, and finding things within them

2006-11-09 Thread Daniel Nogradi
> I have a program that keeps some of its data in a list of tuples. > Sometimes, I want to be able to find that data out of the list. Here is > the list in question: > > [('password01', 'unk'), ('host', 'dragonstone.org'), ('port', '1234'), > ('character01', 'Thessalus')] > > For a regular list, I

Useless thread about some useless statistics

2006-11-16 Thread Daniel Nogradi
I recently came across the program 'sloccount' that attempts to calculate the time and money that went into writing software. http://www.dwheeler.com/sloccount/ If ran on the source code of python 2.5 the results are the following: Total Physical Source Lines of Code (SLOC) = 689,99

Re: ideas for programs?

2006-06-04 Thread Daniel Nogradi
> I've been learning python for the past couple of months and writing > misc scripts here and there, along with some web apps. > I'm wondering if anyone has ideas of programs I might try my hand at > making? You could put together a handy CSS generator library that could be used from a python weba

Re: newbie: python application on a web page

2006-06-06 Thread Daniel Nogradi
> > I made this Python calculator that will take an equation as an input > > and will display the computed curves on a shiny Tkinter interface > > well, it doesn't sound like you're quite as newbie-ish as many other > newbies ;-) > > > Now, I'd like to make this application available on a public we

Re: Screen Scraping for Modern Applications?

2006-06-11 Thread Daniel Nogradi
> > Scrape means simply scraping pixel colors from locations on the screen. > > I'll worry about assembling it into meaningful information. > > import ImageGrab > im = ImageGrab.grab() > v = im.getpixel((x, y)) > > requires: > > http://www.pythonware.com/products/pil/ > > ## #

Re: Getting Python scripts to execute in RedHat

2006-06-23 Thread Daniel Nogradi
> I apologise if this is a stupid newbie error, but I've been googling > "hash bang" and "shebang" all morning. I've added the shebang to my > scripts: > > #!/usr/bin/python > > I've added execute permissions: > > chmod +rx shebang.py > > But I still can't execute my scripts by themselves > > sheb

Re: hard to explain for a french ;-)

2006-06-23 Thread Daniel Nogradi
> hi everybody, > > i have a problem with a script. > after a research with my directory, i want to do a popup of a person's > photo but i don't know the syntax (i'm a newbie) : > > with a javascript : "">Popup don't work > > with the function window.open : tal:attributes="python:onClick string:j

Re: search engine

2006-06-24 Thread Daniel Nogradi
> hai all, > i am student of computer science dept. i have planned to > design a search engine in python. i am seeking info about how to > proceed further. > i need to know what r the modules that can be used. There are these two guys Sacha or Sergey and Larry (if I remember cor

Re: Is there a Python __LINE__ ?

2006-07-06 Thread Daniel Nogradi
> Hi, > > is there a Python aquivalent to the C __LINE__? > > Thank you in advance Google says: http://www.nedbatchelder.com/blog/200410.html#e20041003T074926 -- http://mail.python.org/mailman/listinfo/python-list

Re: Avoiding if..elsif statements

2006-08-25 Thread Daniel Nogradi
> Code: > > value = self.dictionary.get(keyword)[0] > > if value == "something": > somethingClass.func() > elsif value == "somethingElse": > somethingElseClass.func() > elsif value == "anotherthing": > anotherthingClass.func() > elsif value == "yetanotherthing": > yetanotherthingCla

Re: Libraries in python

2006-09-02 Thread Daniel Nogradi
> Hy people, I'm new in python and comming from JAVA. > > Something I really like in java is the easy way to add a library to the > project. Just put the jar file in the folder ( WEB-INF/lib ) and > doesn't need to restart the server ( tomcat ). > > Can I do some like using python - I'm using apach

Re: Managing database tables through web-forms (automatically)

2006-09-03 Thread Daniel Nogradi
> >> Check out Django, it has a great database API and on the fly > >> auto-generated admin. > > > > Just gone over the tutorial, really amazing, exactly what I need. > > That's exactly the response I had when I met with Django :) > Anyone with Django experience: how well does it do with respect t

[ANN] markup.py 1.5 - a lightweight HTML/XML generator

2006-09-04 Thread Daniel Nogradi
A new release of markup.py is available at http://markup.sourceforge.net/ The markup module is an intuitive, lightweight, easy-to-use, customizable and pythonic HTML/XML generator. New features in the 1.5 release include: * use attribute=None to have no value for an attribute such as the emp

Re: getting quick arp request

2006-09-07 Thread Daniel Nogradi
> 2) > Still without the above patch on windows, the software "angry ip scan" > for example managed to output a lot of more socket connection. How is > it possible ? This "angry ip scan" thing is written in Java, perhaps you can find it out from the source: http://svn.sourceforge.net/viewvc/ipsca

Re: markup.py 1.5 - a lightweight HTML/XML generator

2006-09-12 Thread Daniel Nogradi
> > A new release of markup.py is available at > > > > http://markup.sourceforge.net/ > > > > The markup module is an intuitive, lightweight, easy-to-use, > > customizable and pythonic HTML/XML generator. [...] > > It's more than only a bit confusing that there's also > > Markup: A toolkit for stre

something for itertools

2006-09-15 Thread Daniel Nogradi
In a recent thread, http://mail.python.org/pipermail/python-list/2006-September/361512.html, a couple of very useful and enlightening itertools examples were given and was wondering if my problem also can be solved in an elegant way by itertools. I have a bunch of tuples with varying lengths and w

Re: something for itertools

2006-09-15 Thread Daniel Nogradi
> > In a recent thread, > > http://mail.python.org/pipermail/python-list/2006-September/361512.html, > > a couple of very useful and enlightening itertools examples were given > > and was wondering if my problem also can be solved in an elegant way > > by itertools. > > > > I have a bunch of tuples

Re: something for itertools

2006-09-16 Thread Daniel Nogradi
> > In a recent thread, > > http://mail.python.org/pipermail/python-list/2006-September/361512.html, > > a couple of very useful and enlightening itertools examples were given > > and was wondering if my problem also can be solved in an elegant way > > by itertools. > > > > I have a bunch of tuples

Re: Pythondocs.info : collaborative Python documentation project

2006-09-16 Thread Daniel Nogradi
> Everytime I am lookink at how to do this or that in Python I write it > down somewhere on my computer. (For ex. Threading. After reading the > official documentation I was a bit perplex. Hopefully I found an > article an managed to implement threads with only like 20 lines of code > in my script.

Re: Pythondocs.info : collaborative Python documentation project

2006-09-17 Thread Daniel Nogradi
> > > That said...the Python docs are open source. Just start going through > > > them and adding examples. > > > > ASPN (activestate) is a good place for examples... > > Yes, but that requires a separate search and depends on an external > organization. Wouldn't it be great if relevant examples we

loop over list and modify in place

2006-09-30 Thread Daniel Nogradi
Is looping over a list of objects and modifying (adding an attribute to) each item only possible like this? mylist = [ obj1, obj2, obj3 ] for i in xrange( len( mylist ) ): mylist[i].newattribute = 'new value' I'm guessing there is a way to do this without introducing the (in principle unnec

Re: loop over list and modify in place

2006-09-30 Thread Daniel Nogradi
> Is looping over a list of objects and modifying (adding an attribute > to) each item only possible like this? > > mylist = [ obj1, obj2, obj3 ] > > for i in xrange( len( mylist ) ): > mylist[i].newattribute = 'new value' > > > I'm guessing there is a way to do this without introducing the (in

Re: loop over list and modify in place

2006-09-30 Thread Daniel Nogradi
> Call me crazy, but isn't the simple construct > for obj in mylist: > obj.newattribute = 'new value' > what the OP was looking for? Yes, of course. That's why my follow-up post was this: > Please consider the previous question as an arbitrary random brain > cell fluctuation whose pro

Re: Is this a bug? Python intermittently stops dead for seconds

2006-10-01 Thread Daniel Nogradi
> > > Below is a simple program that will cause python to intermittently > > > stop executing for a few seconds. it's 100% reproducible on my > > > machine. > > > > Confirmed with Python 2.4.2 on Windows. > > > > gc.disable() fixes it, so it looks like you found an inefficiency in the > > Python's

app with standalone gui and web interface

2006-10-02 Thread Daniel Nogradi
What would the simplest way to make an application that has both a web interface and runs from behind a web server but also can be used as a standalone app with a gui? More precisely is it possible to avoid creating an html/xml/whatever based web interface for the web version and separately creatin

Re: app with standalone gui and web interface

2006-10-03 Thread Daniel Nogradi
> > What would the simplest way to make an application that has both a web > > interface and runs from behind a web server but also can be used as a > > standalone app with a gui? More precisely is it possible to avoid > > creating an html/xml/whatever based web interface for the web version > > an

text file parsing (awk -> python)

2006-11-22 Thread Daniel Nogradi
Hi list, I have an awk program that parses a text file which I would like to rewrite in python. The text file has multi-line records separated by empty lines and each single-line field has two subfields: node 10 x -1 y 1 node 11 x -2 y 1 node 12 x -3 y 1 and this I would like to parse into a l

Re: text file parsing (awk -> python)

2006-11-22 Thread Daniel Nogradi
> > I have an awk program that parses a text file which I would like to > > rewrite in python. The text file has multi-line records separated by > > empty lines and each single-line field has two subfields: > > > > node 10 > > x -1 > > y 1 > > > > node 11 > > x -2 > > y 1 > > > > node 12 > > x -3 >

module wide metaclass for new style classes

2006-12-16 Thread Daniel Nogradi
I used to have the following code to collect all (old style) class names defined in the current module to a list called reg: def meta( reg ): def _meta( name, bases, dictionary ): reg.append( name ) return _meta reg = [ ] __metaclass__ = meta( reg ) class c1: pass class c2:

Re: module wide metaclass for new style classes

2006-12-17 Thread Daniel Nogradi
> > I used to have the following code to collect all (old style) class > > names defined in the current module to a list called reg: > > > > > > def meta( reg ): > > def _meta( name, bases, dictionary ): > > reg.append( name ) > > return _meta > > > > reg = [ ] > > __metaclass__ = m

generating method names 'dynamically'

2006-01-26 Thread Daniel Nogradi
Is it possible to have method names of a class generated somehow dynamically? More precisely, at the time of writing a program that contains a class definition I don't know what the names of its callable methods should be. I have entries stored in a database that are changing from time to time and

Re: generating method names 'dynamically'

2006-01-26 Thread Daniel Nogradi
> > Is it possible to have method names of a class generated somehow > dynamically? > > > > More precisely, at the time of writing a program that contains a class > > definition I don't know what the names of its callable methods should > > be. I have entries stored in a database that are changing

Re: generating method names 'dynamically'

2006-01-26 Thread Daniel Nogradi
> > My database has 1 table with 2 fields, one called 'name' and the other > > one called 'age', let's suppose it has the following content, but this > > content keeps changing: > > > > Alice 25 > > Bob 24 > > > > --- program1.py > > > > class klass: > > > > # do the

Re: generating method names 'dynamically'

2006-01-26 Thread Daniel Nogradi
> Here you go: > > >>> database = { > ... "Alice": 24, > ... "Bob":25} > ... > >>> class Lookup(object): > ... def __catcher(self, name): > ... try: > ... print "Hello my name is %s and I'm %s" % (name, > database[name]) > ... except KeyErro

Re: generating method names 'dynamically'

2006-01-27 Thread Daniel Nogradi
> Ouch! This certainly seems like a possible security hole! > > As someone else said, use rewrite rules to get this passed > in as a parameter. I don't get it, why is it more safe to accept GET variables than method names? Concretely, why is the URL http://something.com/script?q=parameter safer th

Re: generating method names 'dynamically'

2006-01-27 Thread Daniel Nogradi
> *>* I don't get it, why is it more safe to accept GET variables than > *>* method names? Concretely, why is the URL > *>* http://something.com/script?q=parameter safer than > *>* http://something.com/script/parameter if in both cases exactly the > *>* same things are happening with 'parameter'? >

OO conventions

2006-02-01 Thread Daniel Nogradi
I'm relatively new to object oriented programming, so get confused about its usage once in a while. Suppose there is a class Image that has a number of methods, rotate, open, verify, read, close, etc. Then to use this class my natural guess would be to have something like image = Image( ) image.re

Re: OO conventions

2006-02-01 Thread Daniel Nogradi
> > In this case, Image seems to be a python module, with the open function > defined, PIL's Image is not a class. > Thanks for the enlightening remarks, especially this last one, indeed, it's not a class. -- http://mail.python.org/mailman/listinfo/python-list

Re: OO conventions

2006-02-02 Thread Daniel Nogradi
> > > In this case, Image seems to be a python module, with the open function > > > defined, PIL's Image is not a class. > > > > > > > Thanks for the enlightening remarks, especially this last one, indeed, > > it's not a class. > > Actually, this way of creating a class instance is good OO practice

Re: OO conventions

2006-02-04 Thread Daniel Nogradi
> > Actually, this way of creating a class instance is good OO practice in > > many places: The Image.open() method acts as a factory-function for > > creating Image objects. > > You don't know, until you inspect the return value, if the created > > object is actually an instance of class Image or

Re: OO conventions

2006-02-06 Thread Daniel Nogradi
> > So after all, what is a 'factory' or 'factory function'? > > A brief explanation in Python terms is at > http://www.aleax.it/ep03_pydp.pdf -- "pages" (slides) 37-44 (the rest of > the presentation is about an even more fundamental design pattern, > "template method"). A far more extensive essa

pythonic exec* spawn*

2006-02-09 Thread Daniel Nogradi
Is it possible to pass a python object to a python program as argument? In my program I would like to start executing an other python program and don't wait until that finishes, only launch it and keep running the original program. The obvious way I can think of it is using the exec* or spawn* fun

Re: pythonic exec* spawn*

2006-02-09 Thread Daniel Nogradi
> >I would like to pass the whole object at once to the second python > >program which should start doing its thing with it while the original > >program should keep running. > > os.fork() does that (on Mac and Unix). > Okay, but how? It seems to me that if the process which issued os.fork() ends,

Re: pythonic exec* spawn*

2006-02-10 Thread Daniel Nogradi
> >> os.fork() does that (on Mac and Unix). > > > >Okay, but how? > > Sorry, fork() is implemented strictly on a 'need to know' basis :-) > > >It seems to me that if the process which issued os.fork() ends, then > >the forked process also ends. > > No, no, they're not a quantum mechanic photon pair

Re: pythonic exec* spawn*

2006-02-11 Thread Daniel Nogradi
> > >> os.fork() does that (on Mac and Unix). > > > > > >Okay, but how? > > > > Sorry, fork() is implemented strictly on a 'need to know' basis :-) > > > > >It seems to me that if the process which issued os.fork() ends, then > > >the forked process also ends. > > > > No, no, they're not a quantum

Embedding an Application in a Web browser

2006-02-14 Thread Daniel Nogradi
> Is it possible to embed a Python application within Internet explorer? > If so how do people recommend going about it. > > As for the application it has to be able display simple animated > graphics such as circles, lines and squares. However if someone clicks > on a shape it should open up anoth

Re: Dive into Python 5.5

2007-06-13 Thread Daniel Nogradi
> class UserDict: > def __init__(self, dict=None): > self.data = {} > if dict is not None: self.update(dict) > > I just don't understant this code, as it is not also mention in the > book. the update is a method of a dict right? in my understanding the > last statement should be

Re: Goto

2007-06-13 Thread Daniel Nogradi
> How does one effect a goto in python? I only want to use it for debug. > I dasn't slap an "if" clause around the portion to dummy out, the > indentation police will nab me. http://entrian.com/goto/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python live environment on web-site?

2007-06-20 Thread Daniel Nogradi
> > I was wondering if there was a python-live-environment available on a > > public web-site similar to the ruby-live-tutorial on > > > > http://tryruby.hobix.com/ > > > > I would prefer something which allows to paste small scripts into a > > text-field, to run them on the server, and to be able

Voluntary Abstract Base Classes

2007-06-29 Thread Daniel Nogradi
Hi list, Well, the short question is: what are they? I've read Guido's python 3000 status report on http://www.artima.com/weblogs/viewpost.jsp?thread=208549 where he mentions ABC's but don't quite understand what the whole story is about. Anyone has good use cases? Daniel -- http://mail.python.

Re: Voluntary Abstract Base Classes

2007-06-29 Thread Daniel Nogradi
> > Well, the short question is: what are they? I've read Guido's python > > 3000 status report on > > http://www.artima.com/weblogs/viewpost.jsp?thread=208549 where he > > mentions ABC's but don't quite understand what the whole story is > > about. > > The story is at PEP 3119: > http://www.python

Re: Memory leak in PyQt application

2007-07-01 Thread Daniel Nogradi
> Python 2.5.1 > Boost.Python > Qt 4.2.2 > SIP 4.6 > PyQt 4.2 > WinXp > > I've a memory leak in a PyQt application and no idea how to find it. What > happens in the application ? > > From QWindow a QDialog is called on a button "pressed()" signal, that > instantiate a QThread and waits for it. If

Re: 15 Exercises to Know A Programming Language

2007-07-03 Thread Daniel Nogradi
> > > "Write a program that takes as its first argument one of the words > > > 'sum,' 'product,' 'mean,' or 'sqrt' and for further arguments a > > > series of numbers. The program applies the appropriate function to > > > the series." > > > > > My solution so far is this: > > > > >http://dpaste.co

Re: python 3.0 or 3000 ....is it worth waiting??? Newbie Question

2007-07-03 Thread Daniel Nogradi
> Hi > I'm considering learning Python...but with the python 3000 comming > very soon, is it worth waiting for?? I know that the old style of > coding python will run parallel with the new, but I mean, its going to > come to an end eventually. > > What do you think?? > Chris 99% of what you would

Re: standalone executables

2007-07-10 Thread Daniel Nogradi
> I need a reference to get all the programs which used to package Python > programs into standalone executables files. > Would you help me? windows: http://www.py2exe.org/ mac: http://cheeseshop.python.org/pypi/py2app/ linux: http://wiki.python.org/moin/Freeze linux/windows: http://python.n

Re: Dynamic method

2007-07-10 Thread Daniel Nogradi
> I have an issue I think Python could handle. But I do not have the knowledge > to do it. > > Suppose I have a class 'myClass' and instance 'var'. There is function > 'myFunc(..)'. I have to add (or bind) somehow the function to the class, or > the instance. Any help, info or point of reference is

Re: Dynamic method

2007-07-11 Thread Daniel Nogradi
> >> I have an issue I think Python could handle. But I do not have the > >> knowledge > >> to do it. > >> > >> Suppose I have a class 'myClass' and instance 'var'. There is function > >> 'myFunc(..)'. I have to add (or bind) somehow the function to the > >> class, or > >> the instance. Any help, i

Re: how to call bluebit...

2007-07-13 Thread Daniel Nogradi
> how to import bluebit matrik calculator that result of singular value > decomposition (SVD) in python programming.. I'm not really sure I understand you but you might want to check out scipy: http://scipy.org/ HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: how to install pygame package?

2007-07-13 Thread Daniel Nogradi
> Im working in red hat linux 9.0. I've downloaded the pygame package > but i dont know how to install it. If anybody has the time to detail > the steps sequentially... thanx! > > P.S. I've downloaded both the tar and the rpm packages... First you can try the rpm package: su (give the root passwo

Re: how to install pygame package?

2007-07-14 Thread Daniel Nogradi
> There seems to be some problem. For the tar version, initial steps > execute OK, but after typing: > [EMAIL PROTECTED] pygame-1.7.1release]# ./configure > bash: ./configure: No such file or directory > > So i don't hav a configure file? What should i do now? Sorry, instead of ./configure do this

Re: standalone module

2007-07-15 Thread Daniel Nogradi
> I want to create a standalone program ( an exe file ) from my python files > which works on Windows and Linux. > > Could you please tell me how to do that? The same executable should work on both linux and windows? Not possible. But see: http://mail.python.org/pipermail/python-list/2007-July/4

Re: Python Threads -

2007-04-19 Thread Daniel Nogradi
> Can you please suggest a technique in Python where we can spawn few number > of worker threads and later map them to a function/s to execute individual > Jobs. Have a look at the threading module: http://docs.python.org/lib/module-threading.html HTH, Daniel -- http://mail.python.org/mailman/li

Re: Python un-plugging the Interpreter

2007-04-19 Thread Daniel Nogradi
> Hi All, > I was thinking about the feasbility of adjusting Python as a > compiled language. Being said that I feel these are the following advantages > of doing so -- > 1) Using the powerful easy-to -use feature of Python programming language > constructs. > 2) Making the program to ru

Re: Styled Output

2007-04-21 Thread Daniel Nogradi
> I'm running a program of mine from Linux bash script and it currently > outputs status messages to the command prompt, but they all look a little > boring to say the least, it'll be like this. [snip] > And perhaps have the word 'success' in green, or red for 'failed' and things > like that, jus

Re: Styled Output

2007-04-21 Thread Daniel Nogradi
> > I'm running a program of mine from Linux bash script and it currently > > outputs status messages to the command prompt, but they all look a little > > boring to say the least, it'll be like this. > > [snip] > > > And perhaps have the word 'success' in green, or red for 'failed' and > things >

Re: Dictionaries and dot notation

2007-04-22 Thread Daniel Nogradi
> > This may be pretty obvious for most of you: > > > > When I have an object (an instance of a class "Foo") I can access > > attributes via dot notation: > > > > aFoo.bar > > > > however when I have a dictionary > > > > aDict = {"bar":"something"} > > > > I have to write > > > >

Re: Dictionaries and dot notation

2007-04-22 Thread Daniel Nogradi
> > This may be pretty obvious for most of you: > > > > When I have an object (an instance of a class "Foo") I can access > > attributes via dot notation: > > > > aFoo.bar > > > > however when I have a dictionary > > > > aDict = {"bar":"something"} > > > > I have to write > > > >

Re: serializable object references

2007-04-22 Thread Daniel Nogradi
> Is it possible to convert an object into a string that identifies the > object in a way, so it can later be looked up by this string. > Technically this should be possible, because things like > > <__main__.Foo instance at 0xb7cfb6ac> > > say everything about an object. But how can I look up the

Re: Socket exceptions aren't in the standard exception hierarchy

2007-04-23 Thread Daniel Nogradi
> 2. File "D:\Python24\lib\socket.py", line 295, in read > data = self._sock.recv(recv_size) > error: (10054, 'Connection reset by peer') > > >>> That looks like M$ Windows version of UNIX/Linux error number 54 > >>> (pretty much all Windows socket errors are UNIX number+100

Re: Would You Write Python Articles or Screencasts for Money?

2007-04-24 Thread Daniel Nogradi
[Alex] > When cash is involved, it's important to avoid even the > slightest hint of a suggestion of a suspicion of a conflict of interest I propose the non-PSF sponsored Grand Prize For Successfully Squeezing 4 Of's In A Single Sentence should be received by Alex Martelli this month :) -- http:/

Re: If Dict Contains...

2007-04-25 Thread Daniel Nogradi
> Looking to build a quick if/else statement that checks a dictionary for a > key like follows. > > If myDict contains ThisKey: > > Do this... > > Else > > Do that... > > > > Thats the best way of doing this? if key in myDict: Do this. else: Do that

Re: Now()

2007-04-25 Thread Daniel Nogradi
> I'm using the following function 'str (now)' to place a date time stamp into > a log file, which works fine, however it writes the stamp like this. > > 2007-04-25 11:06:53.873029 > > But I need to expel those extra decimal places as they're causing problems > with the application that parses the

Re: Re-ocurring Events

2007-04-26 Thread Daniel Nogradi
> A bit more of a complex one this time, and I thought I'd get your opinions > on the best way to achieve this. Basically I'm looking for a way to describe > a re-occurring event, like a calendar event or appointment I guess. I'm > likely to use an XML file for the definition of the events, but ima

Re: if __name__ == 'main': & passing an arg to a class objec

2007-04-27 Thread Daniel Nogradi
> The lines > > if __name__ == 'main': >someClass().fn() > > appear at the end of many examples I see. Is this to cause a .class > file to be generated? Python doesn't generate .class files, and the example you mean is probably more like if __name__ == '__main__': .whatever...

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread Daniel Nogradi
> I made a C/S network program, the client receive the zip file from the > server, and read the data into a variable. how could I process the > zipfile directly without saving it into file. > In the document of the zipfile module, I note that it mentions the > file-like object? what does it mean? >

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread Daniel Nogradi
> > > I made a C/S network program, the client receive the zip file from the > > > server, and read the data into a variable. how could I process the > > > zipfile directly without saving it into file. > > > In the document of the zipfile module, I note that it mentions the > > > file-like object?

Re: I/O Operations .....

2007-04-30 Thread Daniel Nogradi
> I am parsing an XML file and sending the output to two files.The > code asks the user to enter the input file,something like: > > file_input = raw_input("Enter The ODX File Path:") > input_xml = open(file_input,'r') > > Now suppose the user enters the path as : > C:\Projects\ODX Import\Sample F

Re: I/O Operations .....

2007-04-30 Thread Daniel Nogradi
> > > I am parsing an XML file and sending the output to two files.The > > > code asks the user to enter the input file,something like: > > > > > file_input = raw_input("Enter The ODX File Path:") > > > input_xml = open(file_input,'r') > > > > > Now suppose the user enters the path as : > > > C:\

Re: sqlite for mac?

2007-05-01 Thread Daniel Nogradi
> Does sqlite come in a mac version? > The interface (pysqlite) is part of the python 2.5 standard library but you need to install sqlite itself separately (as far as I remember) from www.sqlite.org Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: zipfile: grabbing whole directories

2007-05-01 Thread Daniel Nogradi
> The built in zipfile.write doesn't seem to like taking a directory instead > of a filename. > > for example: > for each in listofdir: > archive.write(each) > > blows up when one of the items listed in listofdir is a subdirectory. > > File "/usr/local/lib/python2.4/zipfile.py",

  1   2   3   >