Re: Feature request: String-inferred names

2009-11-25 Thread Gregory Ewing
On Wed, 25 Nov 2009 20:44:36 -0600, The Music Guy declaimed the following in gmane.comp.python.general: I just posted to my blog about a feature that I'd like to see added to Python. http://alphaios.blogspot.com/2009/11/python-string-inferred-names-working.html I don't think getattr and seta

Re: Can "self" crush itself?

2009-11-25 Thread Gregory Ewing
n00m wrote: I can't understand why we can get __name__, but not __dict__, on the module level? For much the same reason that you can see your own feet but (unless you look in a mirror) you can't see your own eyes. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature request: String-inferred names

2009-11-25 Thread Lie Ryan
Brad wrote: On Nov 25, 10:49 pm, Chris Rebert wrote: On Wed, Nov 25, 2009 at 6:35 PM, The Music Guy wrote: Hello all, I just posted to my blog about a feature that I'd like to see added to Python. Before I go through the trouble of learning how to write a PEP or how to extend the Python inte

Re: Feature request: String-inferred names

2009-11-25 Thread Gabriel Genellina
En Wed, 25 Nov 2009 23:35:06 -0300, The Music Guy escribió: I just posted to my blog about a feature that I'd like to see added to Python. Before I go through the trouble of learning how to write a PEP or how to extend the Python interpreter, I want to know what people in the community have t

Re: High-performance Python websites

2009-11-25 Thread ShoqulKutlu
Hi again, I also want to say something about creating a better web application. If I were you I wouldn't use any web framework like django or other. If you want to create a commercial project and want to manage all modules of the application yourself I suggest you to create your own framework. I d

Re: High-performance Python websites

2009-11-25 Thread ShoqulKutlu
Hi Nick, Sorry about my concern on Google. It caused a confusion about Google groups. I didn't mean explicitly where Google uses python, I mentioned just Google uses Python. A Google officer told that they run Python on thousands of their servers at an interview. Due to this claim I wanted to say

Re: Feature request: String-inferred names

2009-11-25 Thread The Music Guy
P.S., my apologies for sending replies with different email addresses. This is an unintentional technical issue and I am currently trying to get it fixed. On Wed, Nov 25, 2009 at 11:45 PM, Brad wrote: > On Nov 25, 10:49 pm, Chris Rebert wrote: > > On Wed, Nov 25, 2009 at 6:35 PM, The Music Guy

Re: Feature request: String-inferred names

2009-11-25 Thread Brad
On Nov 25, 10:49 pm, Chris Rebert wrote: > On Wed, Nov 25, 2009 at 6:35 PM, The Music Guy > > wrote: > > Hello all, > > > I just posted to my blog about a feature that I'd like to see added to > > Python. Before I go through the trouble of learning how to write a PEP or > > how to extend the Pyth

Re: High-performance Python websites

2009-11-25 Thread Nick Mellor
Thanks Kutlu, I wasn't aware that Google used Python for running their Google groups servers. Can you confirm that? The only place I've seen Google explicitly use Python on their web front end is in the Google Ads tests. I am impressed by the responsiveness of lawrence.com, ljworld.com and others

Re: Feature request: String-inferred names

2009-11-25 Thread Chris Rebert
On Wed, Nov 25, 2009 at 6:35 PM, The Music Guy wrote: > Hello all, > > I just posted to my blog about a feature that I'd like to see added to > Python. Before I go through the trouble of learning how to write a PEP or > how to extend the Python interpreter, I want to know what people in the > comm

Re: How do I correctly download Wikipedia pages?

2009-11-25 Thread Taskinoor Hasan
I fetched a different problem. Whenever I tried to fetch any page from wikipedia, I received 403. Then I found that wikipedia don't accept the default user-agent (might be python-urllib2.x or something like this). After setting my own user-agent, it worked fine. You can try this if you receive 403.

Re: How do I correctly download Wikipedia pages?

2009-11-25 Thread Stephen Hansen
2009/11/25 Steven D'Aprano > I'm trying to scrape a Wikipedia page from Python. Following instructions > here: > > Have you checked out http://meta.wikimedia.org/wiki/Pywikipediabot? Its not just via urllib, but I've scraped several MediaWiki-based sites with the software successfully. --S --

Re: How do I correctly download Wikipedia pages?

2009-11-25 Thread ShoqulKutlu
Hi, Try not to be caught if you send multiple requests :) Have a look at here: http://wolfprojects.altervista.org/changeua.php Regards Kutlu On Nov 26, 5:45 am, Steven D'Aprano wrote: > I'm trying to scrape a Wikipedia page from Python. Following instructions > here: > > http://en.wikipedia.or

How do I correctly download Wikipedia pages?

2009-11-25 Thread Steven D'Aprano
I'm trying to scrape a Wikipedia page from Python. Following instructions here: http://en.wikipedia.org/wiki/Wikipedia:Database_download http://en.wikipedia.org/wiki/Special:Export I use the URL "http://en.wikipedia.org/wiki/Special:Export/Train"; instead of just "http://en.wikipedia.org/wiki/T

Re: Can "self" crush itself?

2009-11-25 Thread Mel
n00m wrote: > > aaah... globals()... > Then why "self" not in globals()? > > class Moo: > cnt = 0 > def __init__(self, x): > self.__class__.cnt += 1 > if self.__class__.cnt < 3: > self.x = x > else: > print id(self) > for item i

Re: Can "self" crush itself?

2009-11-25 Thread Steven D'Aprano
On Wed, 25 Nov 2009 18:39:09 -0800, n00m wrote: > aaah... globals()... > Then why "self" not in globals()? > > class Moo: > cnt = 0 > def __init__(self, x): > self.__class__.cnt += 1 Because it isn't a global, it's a local -- it is defined inside a class. Inside functions and c

Re: jython and java application

2009-11-25 Thread ShoqulKutlu
Hi, I don't know how do you call the java library from within your jython application it gives java.lang.NoClassDefFoundError This looks like you referenced jar or whatever else from your jython application which also needs a class com/bloomberglp/blpapi/Session in another library file. It might r

Re: jython and java application

2009-11-25 Thread KB
Hmmm, for some reason my follow up post didn't make it. Modified jython script to: # Eclipse package name for java application import krbtest import java.lang as lang from java.lang import String from jarray import array myargs=array([],String) krbtest.SimpleHistoricTutorial().main(myargs) **

Re: Feature request: String-inferred names

2009-11-25 Thread The Music Guy
I just posted to my blog about a feature that I'd like to see added to Python. Before I go through the trouble of learning how to write a PEP or how to extend the Python interpreter, I want to know what people in the community have to say about it. http://alphaios.blogspot.com/2009/11/python-strin

Re: Can "self" crush itself?

2009-11-25 Thread n00m
aaah... globals()... Then why "self" not in globals()? class Moo: cnt = 0 def __init__(self, x): self.__class__.cnt += 1 if self.__class__.cnt < 3: self.x = x else: print id(self) for item in globals().items(): pr

Help with error on self.show

2009-11-25 Thread Christian Grise
Hi, I am getting an error when I try to run some code my friend gave me. Here is the error: Warning (from warnings module): File "C:\Documents and Settings\GriseC\Desktop\Widget Base\applet.py", line 145 self.show() GtkWarning: ../../../../gtk+/gdk/win32/gdkwindow-win32.c:1089: SetWindowLon

Feature request: String-inferred names

2009-11-25 Thread The Music Guy
Hello all, I just posted to my blog about a feature that I'd like to see added to Python. Before I go through the trouble of learning how to write a PEP or how to extend the Python interpreter, I want to know what people in the community have to say about it. http://alphaios.blogspot.com/2009/11/

Re: Can "self" crush itself?

2009-11-25 Thread Steven D'Aprano
On Wed, 25 Nov 2009 20:09:25 -0500, Terry Reedy wrote: > n00m wrote: >>> Or just raise an exception in __init__(),.. >> >> Then we are forced to handle this exception outside of class code. It's >> Ok. Never mind. >> >> >> Next thing. >> I can't understand why we can get __n

Re: embed installed python dynamically

2009-11-25 Thread naveen
ok, its even easier than that. With autohotkey: pythondll := DllCall("LoadLibrary", "str", "c:\windows \system32\python26.dll") init := DllCall("c:\windows\system32\python26.dll\Py_Initialize" , "Cdecl") msgbox python initalized call := DllCall("c:\windows\system32\python26.dll\PyRun_SimpleString"

Re: jython and java application

2009-11-25 Thread ShoqulKutlu
I don't know if it's right place but normally main method requires an args even it is not needed to supply from commandline. Maybe this is a jython runtime error and requires at least an empty argument. You could try to pass and empty string array like ['']. I'm not using jython please use your own

Re: jython and java application

2009-11-25 Thread MRAB
KB wrote: Hi there, Apologies if this is on the wrong group, this is a jython question. Please redirect me to the correct group if this is in error. I have a java application that takes no arguements. When I run it, it spits out output, and finishes. I am trying to run this java application fr

jython and java application

2009-11-25 Thread KB
Hi there, Apologies if this is on the wrong group, this is a jython question. Please redirect me to the correct group if this is in error. I have a java application that takes no arguements. When I run it, it spits out output, and finishes. I am trying to run this java application from jython 2.

Re: Can "self" crush itself?

2009-11-25 Thread Terry Reedy
n00m wrote: Or just raise an exception in __init__(),.. Then we are forced to handle this exception outside of class code. It's Ok. Never mind. Next thing. I can't understand why we can get __name__, but not __dict__, on the module level? print __name__ print __dict__

Re: embed installed python dynamically

2009-11-25 Thread naveen
ok, it was almost intuitive. just made a simple visual c express dll project included python26\include and python26\libs in the project settings the debug version has issues, but the release compiles without a problem. here is the source: http://github.com/tinku99/embedpython -- http://mail.python

Re: Can "self" crush itself?

2009-11-25 Thread n00m
> Or just raise an exception in __init__(),.. Then we are forced to handle this exception outside of class code. It's Ok. Never mind. Next thing. I can't understand why we can get __name__, but not __dict__, on the module level? print __name__ print __dict__ >>> =

Re: High-performance Python websites

2009-11-25 Thread ShoqulKutlu
Hi, Managing load of high volume of visitors is a common issue for all kind of web technologies. I mean this is not the python issue. This issue is mostly about server level designs. You need to supply load balancing for both web servers and databases to make your web site able to respond to sever

Re: Python 3.1 cx_Oracle 5.0.2 "ImportError: DLL load failed: The specified module could not be found."

2009-11-25 Thread André
On Nov 19, 6:57 pm, Neil Hodgson wrote: > André: > > > Apparently the error is caused by cx_Oracle not being able to find the > > Oracle client DLLs (oci.dll and others). The client home path and the > > client home path bin directory are in the PATH System Variable and > > oci.dll is there. > >  

High-performance Python websites

2009-11-25 Thread Nick Mellor
Hi all, I'm contemplating setting up a Python-powered website for the tourist industry, which will involve a web service, a good deal of XML processing, and a Django-powered front-end. If the project works, it could get a lot of traffic. I'm sure it can be done, but I'm looking to find out more ab

embed python dynamically

2009-11-25 Thread naveen
How do you embed the python dll file distributed with the automatic installable python distribution on windows? Is it possible to dynamically load the python dll from running c program and start up a python interpreter ? Do you have to compile python from source to be able to embed python? -- htt

Re: reading windows event logs

2009-11-25 Thread Mark Hammond
On 26/11/2009 7:22 AM, EW wrote: Hi All, I'm looking for some guidance on a better way to read eventlogs from windows servers. I've written a handy little app that relies on WMI to pull the logs an in all my testing it worked great. When I deployed it, however, WMI choked on servers with

Re: confused with os.fork()

2009-11-25 Thread MRAB
Sandy wrote: Hi all, I am a little bit confused about os.fork(). Say I have the following code. import os a = ['a','b','c','d','e'] for i in xrange(len(a)): pid = os.fork() if not pid: print a[i] os._exit(0) From most of the tuts and examples I saw online, I expect it

Re: reposition a column

2009-11-25 Thread Vlastimil Brom
2009/11/25 Francesco Pietra : > Hi: > > In a pdb file made of lines "ATOM .." (see attachment as I was unable > to obtain plain text with gmail) I would like to reposition the second > "W" from column 19 to 17 ( (Python numbering; in pdb numbering it > would be 20 18). I started with bold slices, t

Re: reposition a column

2009-11-25 Thread MRAB
Francesco Pietra wrote: Hi: In a pdb file made of lines "ATOM .." (see attachment as I was unable to obtain plain text with gmail) I would like to reposition the second "W" from column 19 to 17 ( (Python numbering; in pdb numbering it would be 20 18). I started with bold slices, then I was unabl

Re: Python & OpenOffice Spreadsheets

2009-11-25 Thread bobicanprogram
On Nov 23, 5:49 am, Gerhard Häring wrote: > Is there a *simple* way to read OpenOffice spreadsheets? > > Bonus: write them, too? > > I mean something like: > > doc.cells[0][0] = "foo" > doc.save("xyz.ods") > > >From a quick look, pyodf offers little more than just using a XML parser > > directly.

Re: confused with os.fork()

2009-11-25 Thread Diez B. Roggisch
Sandy schrieb: Hi all, I am a little bit confused about os.fork(). Say I have the following code. import os a = ['a','b','c','d','e'] for i in xrange(len(a)): pid = os.fork() if not pid: print a[i] os._exit(0) From most of the tuts and examples I saw online, I expect it

confused with os.fork()

2009-11-25 Thread Sandy
Hi all, I am a little bit confused about os.fork(). Say I have the following code. import os a = ['a','b','c','d','e'] for i in xrange(len(a)): pid = os.fork() if not pid: print a[i] os._exit(0) >From most of the tuts and examples I saw online, I expect it to print a,b,c,

Re: creating pipelines in python

2009-11-25 Thread Stefan Behnel
per, 25.11.2009 17:42: > Thanks to all for your replies. i want to clarify what i mean by a > pipeline. a major feature i am looking for is the ability to chain > functions or scripts together, where the output of one script -- which > is usually a file -- is required for another script to run.

reposition a column

2009-11-25 Thread Francesco Pietra
Hi: In a pdb file made of lines "ATOM .." (see attachment as I was unable to obtain plain text with gmail) I would like to reposition the second "W" from column 19 to 17 ( (Python numbering; in pdb numbering it would be 20 18). I started with bold slices, then I was unable to complete the script.

Re: Can "self" crush itself?

2009-11-25 Thread Aahz
In article , Chris Rebert wrote: > >If you want to prevent an instance being created in the first place, >you can override __new__(). Or just raise an exception in __init__(), which I think is more common practice. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/

Re: Python Statements/Keyword Localization

2009-11-25 Thread Terry Reedy
Emanuele D'Arrigo wrote: Greetings everybody, some time ago I saw a paper that used an XSL transformation sheet to transform (if I remember correctly) a Chinese xml file (inclusive of Chinese-script XML tags) into an XHTML file. More recently you might have all heard how the ICANN has opened up

Re: reading windows event logs

2009-11-25 Thread MRAB
EW wrote: Hi All, I'm looking for some guidance on a better way to read eventlogs from windows servers. I've written a handy little app that relies on WMI to pull the logs an in all my testing it worked great. When I deployed it, however, WMI choked on servers with a lot of logs. I've tri

Re: csv and mixed lists of unicode and numbers

2009-11-25 Thread Sibylle Koczian
Terry Reedy schrieb: In Python 3, a file opened in 'b' mode is for reading and writing bytes with no encoding/decoding. I believe cvs works with files in text mode as it returns and expects strings/text for reading and writing. Perhaps the cvs doc should say must not be opened in 'b' mode. Not

Re: Python Statements/Keyword Localization

2009-11-25 Thread garabik-news-2005-05
Emanuele D'Arrigo wrote: > Greetings everybody, > > some time ago I saw a paper that used an XSL transformation sheet to > transform (if I remember correctly) a Chinese xml file (inclusive of > Chinese-script XML tags) into an XHTML file. > > More recently you might have all heard how the ICANN

reading windows event logs

2009-11-25 Thread EW
Hi All, I'm looking for some guidance on a better way to read eventlogs from windows servers. I've written a handy little app that relies on WMI to pull the logs an in all my testing it worked great. When I deployed it, however, WMI choked on servers with a lot of logs. I've tried pulling t

Re: Python Statements/Keyword Localization

2009-11-25 Thread MRAB
Emanuele D'Arrigo wrote: Greetings everybody, some time ago I saw a paper that used an XSL transformation sheet to transform (if I remember correctly) a Chinese xml file (inclusive of Chinese-script XML tags) into an XHTML file. More recently you might have all heard how the ICANN has opened up

Re: Help with pprint

2009-11-25 Thread Terry Reedy
Nadav Chernin wrote: Hello, I want to print list of lists in matrix format. So I use pprint with parameter ‘width’ for this target. For example : >>> data=[[1, 1, 1], [1, 1, 1], [1, 1, 1]] >>> pprint(data,width=20) [[1, 1, 1], [1, 1, 1], [1, 1, 1]] The problem that I don’t know how to

Re: How to log messages _only once_ from all modules ?

2009-11-25 Thread Terry Reedy
Jean-Michel Pichavant wrote: Basically, never configure or add handlers to any logger except for the root logger in your __main__ section. There are very few reasons why you would break this rule. And when you'll be familiar with the logging module you'll when to break it. I have never use

Re: python gui builders

2009-11-25 Thread Stef Mientki
Shawn Wheatley wrote: It's not quite all encompassing, but I found this link last year when looking for a similar comparison of Python GUIs: http://ginstrom.com/scribbles/2008/02/26/python-gui-programming-platforms-for-windows/ Tkinter, Qt, GTK, IronPython... I think the only thing missing is Jy

A language for S40 mobiles

2009-11-25 Thread Saket Bharambe
Hey, I have recently created an application for S60 mobiles. But I want to create a similar application for S40 mobiles too. I did the application of S60 in pyS60 as java had problems with accessing inbox and contacts. I tried searching for pyS40 , but i couldnt find it. Ques : Is there python for

Python Statements/Keyword Localization

2009-11-25 Thread Emanuele D'Arrigo
Greetings everybody, some time ago I saw a paper that used an XSL transformation sheet to transform (if I remember correctly) a Chinese xml file (inclusive of Chinese-script XML tags) into an XHTML file. More recently you might have all heard how the ICANN has opened up the way for non-latin char

Re: QtPython: removeChild/addChild QGroupBox

2009-11-25 Thread David Boddie
On Mon Nov 23 10:35:26 CET 2009, Threader Slash wrote: > I am developing a system for a customer which is displayed in a set of > GroupBox. > Depending on mouse events, the container (groupBox) must be removed from > the centralwidget, or then added with new updated data for the table. > Here is a

Re: CentOS 5.3 vs. Python 2.5

2009-11-25 Thread Jeff McNeil
On Nov 25, 4:45 am, Jon Clements wrote: > On Nov 25, 8:13 am, Steven D'Aprano > > > > > > wrote: > > On Tue, 24 Nov 2009 22:42:28 -0800, John Nagle wrote: > > > My dedicated hosting provider wants to switch me to a new server with > > > CentOS 5.3, so I have to look at how much work is required.

Re: How to run python script in emacs

2009-11-25 Thread doug
When I type C-c C-c my emacs window just hangs. If I use Task Manager to kill cmdproxy I can get emacs back but of course interactivity with Python is not accomplished. By the way, if I do C-c ! then I get a functional python shell. Does anybody know a solution to this? On Oct 13, 7:12 am, rus

Re: Help with pprint

2009-11-25 Thread Emile van Sebille
On 11/25/2009 4:47 AM Nadav Chernin said... Hello, I want to print list of lists in matrix format. So I use pprint with parameter ‘width’ for this target. The problem that I don’t know how to select width value, because if: >>>data=[['one', 'one', 'one'], ['one', 'one', 'one'], ['one', 'o

Re: csv and mixed lists of unicode and numbers

2009-11-25 Thread M.-A. Lemburg
Sibylle Koczian wrote: > Hello, > > I want to put data from a database into a tab separated text file. This > looks like a typical application for the csv module, but there is a > snag: the rows I get from the database module (kinterbasdb in this case) > contain unicode objects and numbers. And of

Re: attributes, properties, and accessors -- philosophy

2009-11-25 Thread Bruno Desthuilliers
Ethan Furman a écrit : Very helpful, thank you. Hopefully my brain will be up to the descriptor protocol this time... the last couple times were, um, less than successful. :) Well, it's quite simple in fact. Most of the "magic" happens in object.__getattribute__ and object.__setattr__. Yo

Re: creating pipelines in python

2009-11-25 Thread per
Thanks to all for your replies. i want to clarify what i mean by a pipeline. a major feature i am looking for is the ability to chain functions or scripts together, where the output of one script -- which is usually a file -- is required for another script to run. so one script has to wait for t

Re: IDE+hg

2009-11-25 Thread NiklasRTZ
On Nov 24, 3:13 pm, Richard Riley wrote: > Gerhard Häring writes: > > Rhodri James wrote: > >> On Mon, 23 Nov 2009 19:20:27 -, NiklasRTZ wrote: > > >>> Dear experts, > >>> Since no py IDE I found has easy hg access. IDEs PIDA and Eric claim > >>> Mercurial support not found i.e. buttons to c

Re: IDE+hg

2009-11-25 Thread NiklasRTZ
On Nov 24, 2:35 pm, Gerhard Häring wrote: > Rhodri James wrote: > > On Mon, 23 Nov 2009 19:20:27 -, NiklasRTZ wrote: > > >> Dear experts, > >> Since no py IDE I found has easy hg access. IDEs PIDA and Eric claim > >> Mercurial support not found i.e. buttons to clone, commit and push to > >> r

Re: IDE+hg

2009-11-25 Thread NiklasRTZ
On Nov 23, 11:37 pm, "Rhodri James" wrote: > On Mon, 23 Nov 2009 19:20:27 -, NiklasRTZ wrote: > > Dear experts, > > Since no py IDE I found has easy hg access. IDEs PIDA and Eric claim > > Mercurial support not found i.e. buttons to clone, commit and push to > > repositories to define dev env

Re: Workaround To Add Value To TextArea

2009-11-25 Thread Jitish
On Nov 25, 8:27 pm, Rami Chowdhury wrote: > > Rami Chowdhury > "Never assume malice when stupidity will suffice." -- Hanlon's Razor > 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD) > > On Wed, Nov 25, 2009 at 07:19, Victor Subervi wrote: > > Hi; > > I've noticed that html does

Re: attributes, properties, and accessors -- philosophy

2009-11-25 Thread Ethan Furman
Bruno Desthuilliers wrote: Ethan Furman a écrit : Let's head towards murkier waters (at least murkier to me -- hopefully they can be easily clarified): some of the attributes are read-only, such as record count; others are not directly exposed, but still settable, such as table version; an

Re: Workaround To Add Value To TextArea

2009-11-25 Thread Victor Subervi
On Wed, Nov 25, 2009 at 10:27 AM, Rami Chowdhury wrote: > You'll find the textarea and input tags differ significantly, even > though they're both typically used in HTML forms. The W3C page has a > fair overview of how various parts of HTML forms work in HTML 4.01, > and it's roughly accurate for

Re: Workaround To Add Value To TextArea

2009-11-25 Thread Rami Chowdhury
Rami Chowdhury "Never assume malice when stupidity will suffice." -- Hanlon's Razor 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD) On Wed, Nov 25, 2009 at 07:19, Victor Subervi wrote: > Hi; > I've noticed that html doesn't support a "value" attribute for textarea. I > have a

Workaround To Add Value To TextArea

2009-11-25 Thread Victor Subervi
Hi; I've noticed that html doesn't support a "value" attribute for textarea. I have a form in which I enable users to edit data they've entered into my database, and one of the data is a textarea. How do I fill the textarea with the value, or what kind of workaround can I create? TIA, Victor -- ht

Re: Beginning Question about Python functions, parameters...

2009-11-25 Thread Lie Ryan
astral orange wrote: As for the "class Name():" example above? Even though I haven't seen exactly what purpose 'self' serves In many other programming language, self (or this, or Me) refers the the current class instance. In some languages, you can refer to an instance attribute without an e

Re: 'classmethod' object has only read-only attributes

2009-11-25 Thread Peter Otten
Thomas Guettler wrote: > Hi, > > why have classmethods only readonly attributes? It works for other > methods. > > exmpale code: > {{{ > class Foo(object): > @classmethod > def bar(cls): > pass > bar.myattr='test' > }}} > > u...@host:~> python ~/tmp/t.py > Traceback (most re

Re: How to import a file by its full path using C api?

2009-11-25 Thread lallous
Looks like one way to do that is to use something like: s.sprintf( "import imp\n" "imp.load_source('%s', r'%s')", modname, script_path); PyRun_SimpleString(s.c_str()); Unless someone has a better suggestion. Regards, Elias "lallous" wrote in message news:heir4g$oh...@aioe.org..

'classmethod' object has only read-only attributes

2009-11-25 Thread Thomas Guettler
Hi, why have classmethods only readonly attributes? It works for other methods. exmpale code: {{{ class Foo(object): @classmethod def bar(cls): pass bar.myattr='test' }}} u...@host:~> python ~/tmp/t.py Traceback (most recent call last): File "/home/user/tmp/t.py", line 1, i

Re: (pywin related) pywintypes.com_error: -2147417846 "Application busy"

2009-11-25 Thread Alexander Eisenhuth
I don't think so, because it happens very rarely Michel Claveau - MVP schrieb: Hi! Your computer is too slow, for launch Excel. Configure the machine for more speed... @+ -- http://mail.python.org/mailman/listinfo/python-list

Re: Raw strings as input from File?

2009-11-25 Thread Jon Clements
On Nov 25, 3:31 am, Grant Edwards wrote: > On 2009-11-25, Rhodri James wrote: > > > > > On Tue, 24 Nov 2009 21:20:25 -, utabintarbo   > > wrote: > > >> On Nov 24, 3:27 pm, MRAB wrote: > > >>> .readlines() doesn't change the "\10" in a file to "\x08" in the string > >>> it returns. > > >>> C

Re: (pywin related) pywintypes.com_error: -2147417846 "Application busy"

2009-11-25 Thread Michel Claveau - MVP
Hi! Your computer is too slow, for launch Excel. Configure the machine for more speed... @+ -- MCI -- http://mail.python.org/mailman/listinfo/python-list

(pywin related) pywintypes.com_error: -2147417846 "Application busy"

2009-11-25 Thread Alexander Eisenhuth
Hello list, I'm having a problem with a python COM Excel client that rarely gets the exception pywintypes.com_error with the error code -2147417846. (means Excel is busy) Here the python code of the exception handling: [...] try: # write a excel cell [...] except pywintypes.com_error, ex:

Help with pprint

2009-11-25 Thread Nadav Chernin
Hello, I want to print list of lists in matrix format. So I use pprint with parameter 'width' for this target. For example : >>> data=[[1, 1, 1], [1, 1, 1], [1, 1, 1]] >>> pprint(data,width=20) [[1, 1, 1], [1, 1, 1], [1, 1, 1]] The problem that I don't know how to select width value

Re: pointless musings on performance

2009-11-25 Thread Antoine Pitrou
Le Tue, 24 Nov 2009 16:09:10 -0800, Paul Boddie a écrit : > > I'm referring to what you're talking about at the end. The enhancements > in Python 3 presumably came about after discussion of "threaded > interpreters", confirming that the evaluation loop in Python 2 was not > exactly optimal. An op

Re: pointless musings on performance

2009-11-25 Thread Antoine Pitrou
Le Tue, 24 Nov 2009 22:08:19 +, Benjamin Peterson a écrit : > >> Would it be worth in-lining the remaining part of PyObject_IsTrue in >> ceval? > > Inlining by hand is prone to error and maintainability problems. Which is why we like to do it :-)) -- http://mail.python.org/mailman/listinf

Re: How to log messages _only once_ from all modules ?

2009-11-25 Thread Jean-Michel Pichavant
Barak, Ron wrote: Hi, I'm trying to add the logging module to my application, but I seem to be missing something. My application (a wxPython one) has a main script that calls various helper classes. I want the log messages from all modules to go to one central log file. When I implement lo

Re: Can "self" crush itself?

2009-11-25 Thread Ben Finney
n00m writes: > Then how can we destroy the 3rd instance, right after its creation and > from inside class Moo code? Normally, one binds whatever references one needs, and lets the garbage collector clean them up once they fall out of scope. If the references are living beyond their usefulness, t

Re: attributes, properties, and accessors -- philosophy

2009-11-25 Thread Bruno Desthuilliers
Ethan Furman a écrit : (snip) Okay, I'll go back and switch all my attributes *back* to attributes -- and properties will be much nicer than my original implementation (using __getattr__ and __setattr__). It will also be faster FWIW. -- http://mail.python.org/mailman/listinfo/python-list

Re: attributes, properties, and accessors -- philosophy

2009-11-25 Thread Bruno Desthuilliers
Ethan Furman a écrit : Let's head towards murkier waters (at least murkier to me -- hopefully they can be easily clarified): some of the attributes are read-only, such as record count; others are not directly exposed, but still settable, such as table version; and still others require a smal

Re: Can "self" crush itself?

2009-11-25 Thread Chris Rebert
On Wed, Nov 25, 2009 at 1:46 AM, n00m wrote: > Then how can we destroy the 3rd instance, > right after its creation and from inside > class Moo code? Why would you want to do that in the first place? It's strange to say the least. If you want to prevent an instance being created in the first plac

Re: Can "self" crush itself?

2009-11-25 Thread n00m
Then how can we destroy the 3rd instance, right after its creation and from inside class Moo code? class Moo: cnt = 0 def __init__(self, x): self.x = x self.__class__.cnt += 1 if self.__class__.cnt > 2: print id(self) ## 13406816

Re: CentOS 5.3 vs. Python 2.5

2009-11-25 Thread Jon Clements
On Nov 25, 8:13 am, Steven D'Aprano wrote: > On Tue, 24 Nov 2009 22:42:28 -0800, John Nagle wrote: > > My dedicated hosting provider wants to switch me to a new server with > > CentOS 5.3, so I have to look at how much work is required. > > >     CentOS 5.3 apparently still ships with Python 2.4.

How to import a file by its full path using C api?

2009-11-25 Thread lallous
Hello PyObject* PyImport_ImportModule( const char *name) How to specify a full file path instead and a module name? Like PyImport_SomeFunction(const char *path_to_script, const char *name) Thanks, Elias -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginning Question about Python functions, parameters...

2009-11-25 Thread Bruno Desthuilliers
astral orange a écrit : On Nov 23, 10:37 pm, r wrote: (snip) This is a horrible example to show noobs. I think the OP could better understand this as a class EVEN though the OP may or may not know what a class *is* yet. class Name(): def __init__(self, first, middle, last):

Re: CentOS 5.3 vs. Python 2.5

2009-11-25 Thread Steven D'Aprano
On Tue, 24 Nov 2009 22:42:28 -0800, John Nagle wrote: > My dedicated hosting provider wants to switch me to a new server with > CentOS 5.3, so I have to look at how much work is required. > > CentOS 5.3 apparently still ships with Python 2.4. Worse, it > requires Python 2.4 for its own inter

Re: scanning under windows WIA with custom settings (dpi / etc )

2009-11-25 Thread News123
News123 wrote: > Hi, > > I'm trying to scan a document from a python 2.6 script without user > interaction. > > I found a code snippet, that allows me to scan under Vista, but that > doesn't allow me to select the dpi / color mode / etc. I'm still stuck. I'll try to look at any solution (vi