Getting metadata from any database ?
hello, I want to create a (local) database viewer for all databases, it's working now for sqlite3 (python 2.5), and I now want to get it working through odbc, so I can manage most other databases. In sqlite I can get the metadata (tables, stored views, procedures, etc) through pragma statements. Is there a similar way for odbc ? (Couldn't find anything in API 2.0 specs) (mxODBC is not option because my project is an open source project) thanks, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
On Jul 5, 7:01 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Paddy wrote: > > It is not a smarter algorithm that is used in grep. Python RE's have > > more capabilities than grep RE's which need a slower, more complex > > algorithm. > > So you're saying the Python algo is alternatively gifted... > > Peter The following isn't the article I read on regexp types and their speed differences but it does give info on regexp engine types: http://books.google.co.uk/books?id=GX3w_18-JegC&pg=PA145&lpg=PA145&dq=%2Bregex+%2Bspeed+%2Bgrep+%2Btcl+&source=web&ots=PHljNqeuJZ&sig=CyBCOZYsyZaJTMfj2Br53if46Bc&hl=en&sa=X&oi=book_result&resnum=3&ct=result#PPA145,M1 - Paddy. -- http://mail.python.org/mailman/listinfo/python-list
ANN: eric 4.1.6 released
Hi, this is to inform all of you about the immediate availability of eric 4.1.5. It is a bug fix release. As usual, it is available via http://www.die-offenbachs.de/eric/index.html. Eric4 is a Python IDE written using PyQt4 and QScintilla2. It comes with batteries included. For more details see the link above. Regards, Detlev -- Detlev Offenbach [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
multi-platform browser embedding
I fiddled a little with pyGTK and was quite happy to discover gtkMozEmbed because I want to write an application for Linux and Windows with a powerful browser widget. Unfortunatly I couldnt find a way to make gtkMozEmbed work on Windows. Are there alternatives? I'm lazy so I prefer to download binaries for Windows :) but I don't mind building from source as long as I can use MinGW/Msys and avoid an incalculable odyssey through cryptic compiler errors and makefile surgery. Thanks in advance for your hints. -- Joe -- http://mail.python.org/mailman/listinfo/python-list
pythoncom InternetExplorer.Application don't work in vista || firefox pythoncom ?
H! I using a script that opens a internet page in a small window (what I can control) In XP everything was working fine, but now I'm using Vista with IE7 and this is what happends now: First a small window opens at the postion x0 y0 (like I want) but then IE thinks "Hey lets open a other main window too". And that window opens the url 'http://www.google.nl' It seems that I can't control/use my first window anymore, and that IE7/vista is forcing to open it in a big new window. The code below is what I'm using. def webbrowser(url=None): import pythoncom from win32com.client import Dispatch ie = pythoncom.CoCreateInstance("InternetExplorer.Application", None,pythoncom.CLSCTX_SERVER,pythoncom.IID_IDispatch) ie = Dispatch(ie) ie.Top = 0.0 ie.Left = 0.0 ie.Height = 400 ie.Width = 400 ie.AddressBar = False ie.MenuBar = False ie.Resizable = False ie.StatusBar = False ie.ToolBar = False ie.Visible = 1 return ie w = webbrowser() w.Navigate('http://www.google.nl') -- ow and why can't I find a pythoncom.CoCreateInstance.FireFox example ? Thanks for helping. -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
Paddy <[EMAIL PROTECTED]>: > On Jul 4, 1:36 pm, Peter Otten <[EMAIL PROTECTED]> wrote: >> Henning_Thornblad wrote: >> > What can be the cause of the large difference between re.search and >> > grep? >> >> grep uses a smarter algorithm ;) >> >> >> >> > This script takes about 5 min to run on my computer: >> > #!/usr/bin/env python >> > import re >> >> > row="" >> > for a in range(156000): >> > row+="a" >> > print re.search('[^ "=]*/',row) >> >> > While doing a simple grep: >> > grep '[^ "=]*/' input (input contains 156.000 a in >> > one row) >> > doesn't even take a second. >> >> > Is this a bug in python? >> >> You could call this a performance bug, but it's not common enough in real >> code to get the necessary brain cycles from the core developers. >> So you can either write a patch yourself or use a workaround. >> >> re.search('[^ "=]*/', row) if "/" in row else None >> >> might be good enough. >> >> Peter > > It is not a smarter algorithm that is used in grep. Python RE's have > more capabilities than grep RE's which need a slower, more complex > algorithm. FWIW, grep itself can confirm this statement. The following command roughly takes as long as Python's re.search: # grep -P '[^ "=]*/' input -P tells grep to use real perl-compatible regular expressions. -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Tkinter Text widget get()
Hey guys. I am having trouble understanding the get() method from the Tkinter Text() widget. It isn't like the entry.get() one I am used to. I know you have to put tags in, or at least I read. I tried this but it didn't work. I think I was putting the tags in wrong but I am not sure. I just need an example. So if someone could maybe modify this code to get EVERYTHING inside the text widget. text = Text(parent) text.pack() text.insert(END, "I am text!") Of course, I will have much more text, but I still want to get everything in the box. -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
On Jul 5, 4:12 am, "Sebastian \"lunar\" Wiesner" <[EMAIL PROTECTED]> wrote: > Paddy <[EMAIL PROTECTED]>: > > > > > On Jul 4, 1:36 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > >> Henning_Thornblad wrote: > >> > What can be the cause of the large difference between re.search and > >> > grep? > > >> grep uses a smarter algorithm ;) > > >> > This script takes about 5 min to run on my computer: > >> > #!/usr/bin/env python > >> > import re > > >> > row="" > >> > for a in range(156000): > >> > row+="a" > >> > print re.search('[^ "=]*/',row) > > >> > While doing a simple grep: > >> > grep '[^ "=]*/' input (input contains 156.000 a in > >> > one row) > >> > doesn't even take a second. > > >> > Is this a bug in python? > > >> You could call this a performance bug, but it's not common enough in real > >> code to get the necessary brain cycles from the core developers. > >> So you can either write a patch yourself or use a workaround. > > >> re.search('[^ "=]*/', row) if "/" in row else None > > >> might be good enough. > > >> Peter > > > It is not a smarter algorithm that is used in grep. Python RE's have > > more capabilities than grep RE's which need a slower, more complex > > algorithm. > > FWIW, grep itself can confirm this statement. The following command roughly > takes as long as Python's re.search: > > # grep -P '[^ "=]*/' input > > -P tells grep to use real perl-compatible regular expressions. This confirms that a particular engine might not be optimized for it, but it's not necessarily a reflection that the engine is more complex. I'm not sure of the specifics and maybe that is the case, but it could also be a case of a different codebase which is optimized differently. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Not necessarily related to python Web Crawlers
Hi Does anyone here have a good recommendation for an open source crawler that I could get my hands on? It doesn't have to be python based. I am interested in learning how crawling works. I think python based crawlers will ensure a high degree of flexibility but at the same time I am also torn between looking for open source crawlers in python vs C ++ because the latter is much more efficient(or so I heard. I will be crawling on very cheap hardware.) I am definitely open to suggestions. Thx -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter Text widget get()
> Hey guys. I am having trouble understanding the get() method from > the Tkinter Text() widget. It isn't like the entry.get() one I am > used to. I know you have to put tags in, or at least I read. I > tried this but it didn't work. I think I was putting the tags in > wrong but I am not sure. I just need an example. So if someone > could maybe modify this code to get EVERYTHING inside the text widget. > > text = Text(parent) > text.pack() > > text.insert(END, "I am text!") > > Of course, I will have much more text, but I still want to get > everything in the box. > The arguments to the get method of the Text widget are strings in the form of "line.position". So, text.get('1.5', '2.7') returns the text from line 1 position 5 to line 2 position 7. There are also some special tagged names such as END and SEL. So, if you want to get all the text in your Text widget, text.get('1.0', END) will do the trick. I recommend finding the appropriate documentation at http://www.pythonware.com/library/tkinter/introduction/tkinter-reference.htm Regards, John -- http://mail.python.org/mailman/listinfo/python-list
Re: Not necessarily related to python Web Crawlers
just crawling is supereasy. its how to index and search that is hard. just start at yahoo.com, scrape out all the links and then for every site visit every link. i wrote a crawler in 15 lines of code. but then it all it did was visit the sites, not indexing them or anything. you could write a faster one in C++ probably but if you are new to it doing it in python will let you experiment and learn faster. some links: http://infolab.stanford.edu/~backrub/google.html http://www-csli.stanford.edu/~hinrich/information-retrieval-book.html http://www.example-code.com/python/pythonspider.asp http://www.example-code.com/python/spider_simpleCrawler.asp -- http://mail.python.org/mailman/listinfo/python-list
Re: Parsing MIME-encoded data in an HTTP request
Ron Garret wrote: In article <[EMAIL PROTECTED]>, Ron Garret <[EMAIL PROTECTED]> wrote: In article <[EMAIL PROTECTED]>, Michael Ströder <[EMAIL PROTECTED]> wrote: Ron Garret wrote: I'm writing a little HTTP server and need to parse request content that is mime-encoded. All the MIME routines in the Python standard library seem to have been subsumed into the email package, which makes this operation a little awkward. How about using cgi.parse_multipart()? Unfortunately cgi.parse_multipart doesn't handle nested multiparts, which the requests I'm getting have. You have to use a FieldStorage object to do that, and that only works if you're actually in a cgi environment, which I am not. The server responds to these requests directly. Anyway, thanks for the idea. Hm, it actually seems to work if I manually pass in the outerboundary parameter and environ={'REQUEST_METHOD':'POST'} That seems like the Right Answer. I'm also using it to parse form parameters in a message body received by POST. CIao, Michael. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python XML-RPC Server with clientside Javascript
akineko schrieb: Hello everyone, I have used Python SimpleXMLRPCServer to expose several methods to be used. My Python script creates a free-standing server and not a CGI script. I have tested its exposed methods using the following Python script: import xmlrpclib s = xmlrpclib.ServerProxy('http://localhost:8765') print s.my_method() I tested all methods one by one and they are working as I intended. Now, I want to use those exposed methods from a static html file (without any web server) using client side javascript. (i.e. Open File... from the browser (or file://...) ) I found many XML-RPC examples with javascript but all of them I found assume XML-RPC services to be deliver from a web server, such as Apache, as a CGI. I'd think this has nothing to do with CGI vs. "free-standing", the client couldn't tell the difference anyway. It looks like you're running in the "same origin" javascript security restriction enforced by the browser. That is, the origin of your javascript is file://... and you're trying to access http://localhost:8765. This is not allowed. hth Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
Carl Banks <[EMAIL PROTECTED]>: > On Jul 5, 4:12 am, "Sebastian \"lunar\" Wiesner" > <[EMAIL PROTECTED]> wrote: >> Paddy <[EMAIL PROTECTED]>: >> >> >> >> > On Jul 4, 1:36 pm, Peter Otten <[EMAIL PROTECTED]> wrote: >> >> Henning_Thornblad wrote: >> >> > What can be the cause of the large difference between re.search and >> >> > grep? >> >> >> grep uses a smarter algorithm ;) >> >> >> > This script takes about 5 min to run on my computer: >> >> > #!/usr/bin/env python >> >> > import re >> >> >> > row="" >> >> > for a in range(156000): >> >> > row+="a" >> >> > print re.search('[^ "=]*/',row) >> >> >> > While doing a simple grep: >> >> > grep '[^ "=]*/' input (input contains 156.000 a in >> >> > one row) >> >> > doesn't even take a second. >> >> >> > Is this a bug in python? >> >> >> You could call this a performance bug, but it's not common enough in >> >> real code to get the necessary brain cycles from the core developers. >> >> So you can either write a patch yourself or use a workaround. >> >> >> re.search('[^ "=]*/', row) if "/" in row else None >> >> >> might be good enough. >> >> >> Peter >> >> > It is not a smarter algorithm that is used in grep. Python RE's have >> > more capabilities than grep RE's which need a slower, more complex >> > algorithm. >> >> FWIW, grep itself can confirm this statement. The following command >> roughly takes as long as Python's re.search: >> >> # grep -P '[^ "=]*/' input >> >> -P tells grep to use real perl-compatible regular expressions. > > This confirms that a particular engine might not be optimized for it, > but it's not necessarily a reflection that the engine is more complex. My posting wasn't intended to reflect the differences in complexity between normal GNU grep expressions (which are basically extended POSIX expressions) and perl-compatible expressions. The latter just _are_ more complex, having additional features like look aheads or non-greedy qualifiers. I just wanted to illustrate, that the speed of the given search is somehow related to the complexity of the engine. Btw, other pcre implementation are as slow as Python or "grep -P". I tried a sample C++-code using pcre++ (a wrapper around libpcre) and saw it running equally long. -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Margins in the Tkinter Text widget
Okay, so i am trying to have some sort of formatting going on in a textbox, and I need left margins. I see that there are two, one for the first line and th other for every line but that line. My program gives a word and a list of definitions for the word. So my question is how can I make the it repeat itself. Like I want to have something formatted like this: word: definiton1 definition2 word2: defintion12 definition22 and so on. So I don't really understand how to keep like redoing the margins I guess. Would love some help! -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting a path from a file object
Andrew Fong wrote: Newbie question: Let's say I open a new file for writing in a certain path. How do I get that path back? Example: f = open('/some/path/file.ext') some_function(f) '/some/path/file.ext' Does some_function(f) already exist? And if not, how would I define it? -- Andrew Read about f.name which is a kind of read-only attribute with caveats in the documentation: http://docs.python.org/lib/bltin-file-objects.html -- http://mail.python.org/mailman/listinfo/python-list
Re: pydev and psycopg2 - weird behaviour
Hi Ross, Usually that happens when some module contains too much runtime information and the static analysis cannot get it... You can probably fix that by adding 'psycopg2' to the list of builtin modules... See http://fabioz.com/pydev/manual_101_interpreter.html for information on how to configure that (look for forced builtins). Cheers, Fabio On 7/4/08, RossGK <[EMAIL PROTECTED]> wrote: > > > I've been using pydev for a short while successfully, and Django with > postgresql as well. psycopg2 is part of that behind the scenes I would > imagine, to make django work. > > Now I'm trying to use psycopg2 in a non-Django program, I'm seeing some > weird behaviour > > My "import psycopg2" is tagged in pyDev (eclipse) as "Unresolved Import: > psycopg2" > > But when I run my code anyway, I seem to connect to the postgresql DB okay. > If I remove the import, and try it, it fails. > > So it seems to use it, but thinks it's unresolved. Any idea what's going > on there? > > Just to be sure it's installed right, I reinstalled with no change. I also > opened a python shell (cmd window in winXP environment) and on the command > line issued a psycopg2 connect request which succeeds as well. So it mostly > seems to be an erroneous report from pydev that it can't resolve psycopg2 > when it apparently can? > > Your input appreciated... > > Ross. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Python XML-RPC Server with clientside Javascript
Hello Paul, Thank you very much for your prompt and clear answer. I didn't know the "same origin" javascript security policy (as I'm not familiar with javascript). After reading the description of the "same origin" javascript policy, I think you are absolutely correct. The security policy does make sense. However, if that is the case, it seems I have only two options to make my project work: (1) Place my XML-CGI services under a web server so that both HTML page and RPC services are coming from the same origin (2) Expand Python DocXMLRPCServer, which renders a HTML page, to implement my own HTML page from it I wanted to run the program as a standalone one (no external web server required). Therefore, (2) seems the only option I have to make it work. Anyway, thank you for solving my days-long question. Best regards, Aki Niimura On Jul 5, 3:39 am, paul <[EMAIL PROTECTED]> wrote: > > I'd think this has nothing to do with CGI vs. "free-standing", the > client couldn't tell the difference anyway. > It looks like you're running in the "same origin" javascript security > restriction enforced by the browser. That is, the origin of your > javascript is file://... and you're trying to accesshttp://localhost:8765. > This is not allowed. > > hth > Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
On Jul 5, 6:44 am, "Sebastian \"lunar\" Wiesner" <[EMAIL PROTECTED]> wrote: > Carl Banks <[EMAIL PROTECTED]>: > > > > > On Jul 5, 4:12 am, "Sebastian \"lunar\" Wiesner" > > <[EMAIL PROTECTED]> wrote: > >> Paddy <[EMAIL PROTECTED]>: > > >> > On Jul 4, 1:36 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > >> >> Henning_Thornblad wrote: > >> >> > What can be the cause of the large difference between re.search and > >> >> > grep? > > >> >> grep uses a smarter algorithm ;) > > >> >> > This script takes about 5 min to run on my computer: > >> >> > #!/usr/bin/env python > >> >> > import re > > >> >> > row="" > >> >> > for a in range(156000): > >> >> > row+="a" > >> >> > print re.search('[^ "=]*/',row) > > >> >> > While doing a simple grep: > >> >> > grep '[^ "=]*/' input (input contains 156.000 a in > >> >> > one row) > >> >> > doesn't even take a second. > > >> >> > Is this a bug in python? > > >> >> You could call this a performance bug, but it's not common enough in > >> >> real code to get the necessary brain cycles from the core developers. > >> >> So you can either write a patch yourself or use a workaround. > > >> >> re.search('[^ "=]*/', row) if "/" in row else None > > >> >> might be good enough. > > >> >> Peter > > >> > It is not a smarter algorithm that is used in grep. Python RE's have > >> > more capabilities than grep RE's which need a slower, more complex > >> > algorithm. > > >> FWIW, grep itself can confirm this statement. The following command > >> roughly takes as long as Python's re.search: > > >> # grep -P '[^ "=]*/' input > > >> -P tells grep to use real perl-compatible regular expressions. > > > This confirms that a particular engine might not be optimized for it, > > but it's not necessarily a reflection that the engine is more complex. > > My posting wasn't intended to reflect the differences in complexity between > normal GNU grep expressions (which are basically extended POSIX > expressions) and perl-compatible expressions. The latter just _are_ more > complex, having additional features like look aheads or non-greedy > qualifiers. > > I just wanted to illustrate, that the speed of the given search is somehow > related to the complexity of the engine. I don't think you've illustrated that at all. What you've illustrated is that one implementation of regexp optimizes something that another doesn't. It might be due to differences in complexity; it might not. (Maybe there's something about PCREs that precludes the optimization that the default grep uses, but I'd be inclined to think not.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Python with Ecmascript
Hello, for my Python application (Windows platform) to be standards compliant, I need to embbed Ecmascript(Javascript) interpreter - I need to execute plugins written in this language. Which engine is suitable for Python, I have found bunch of them. Any recomendations are welcome. To be more specific, I think that plugins will be pretty simple, they will be used to manipulate my class-based datamodel, no special libraries dependencies ... therefore I prefer some rather simple solution ... Jiri -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
Paddy: > You could argue that if the costly RE features are not used then maybe > simpler, faster algorithms should be automatically swapped in but Many Python implementations contains a TCL interpreter. TCL REs may be better than Python ones, so it can be interesting to benchmark the same RE with TCL, to see how much time it needs. If someone here knows TCL it may require to write just few lines of TCL code (used through tkinter, by direct call). Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
On Jul 5, 1:54 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > I don't think you've illustrated that at all. What you've illustrated > is that one implementation of regexp optimizes something that another > doesn't. It might be due to differences in complexity; it might not. > (Maybe there's something about PCREs that precludes the optimization > that the default grep uses, but I'd be inclined to think not.) It seems like an appropriate moment to point out *this* paper: http://swtch.com/~rsc/regexp/regexp1.html Apparently, grep and Tcl convert a regex to a finite state machine. Matching is then *very* fast: essentially linear time in the length of the string being matched, even in the worst case. Though it is possible for the size of the finite state machine to grow exponentially with the size of the regex. But not all PCREs can be converted to a finite state machine, so Perl, Python, etc. use a backtracking approach, which has exponential running time in the worst case. In particular, it's not possible to use a finite state machine to represent a regular expression that contains backreferences. Part of the problem is a lack of agreement on what 'regular expression' means. Strictly speaking, PCREs aren't regular expressions at all, for some values of the term 'regular expression'. See http://en.wikipedia.org/wiki/Regular_expression Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: Python with Ecmascript
On Sat, 5 Jul 2008 06:28:42 -0700 (PDT), "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > for my Python application (Windows platform) to be standards > compliant, I need to embbed Ecmascript(Javascript) interpreter - I > need to execute plugins written in this language. Which engine is > suitable for Python, I have found bunch of them. Any recomendations > are welcome. > > To be more specific, I think that plugins will be pretty simple, they > will be used to manipulate my class-based datamodel, no special > libraries dependencies ... therefore I prefer some rather simple > solution ... PyQt includes a Javascript interpreter. You can expose Python objects and properties as Javascript objects and properties. Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
On Jul 5, 4:13 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > It seems like an appropriate moment to point out *this* paper: > > http://swtch.com/~rsc/regexp/regexp1.html > That's the one! Thanks Mark. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list
conflict between multiple installs of python (linux)
You learn something new every day: On my ubuntu, update-manager is supposed to use the python2.5 installed on /usr/bin. Well, I had subsequently installed a whole bunch of stuff in /usr/local (/usr/local/bin/python and /usr/local/lib/ python2.5 etc), which I have happily been using for development for a year. I had thought that the two pythons were completely independent. Well, I was wrong. When /usr/bin/python2.5 runs, *by default*, it adds /usr/local/lib/python2.5 to its sys path - and apparently there are things in /usr/local which are inconsistent with those at /usr (not suprising). I have fixed the problem - but I had to modify the actual update- manager .py file itself. At the beginning, I set the sys.path in python *explicitly* to not include the /usr/local stuff. But this is clearly a kludge. My question: how do I keep the Ubuntu python stuff at /usr/bin/python2.5 from adding /usr/local/lib/ python2.5 to the import search path in a clean and global way? I really want both pythons completely isolated from one another! Thankyou. -- http://mail.python.org/mailman/listinfo/python-list
Re: conflict between multiple installs of python (linux)
On Jul 5, 11:09 am, david <[EMAIL PROTECTED]> wrote: > You learn something new every day: > > On my ubuntu, update-manager is supposed to use the python2.5 > installed on /usr/bin. Well, I had subsequently installed a whole > bunch of stuff in /usr/local (/usr/local/bin/python and /usr/local/lib/ > python2.5 etc), which I have happily been using for development for a > year. I had thought that the two pythons were completely independent. > > Well, I was wrong. When /usr/bin/python2.5 runs, *by default*, it > adds /usr/local/lib/python2.5 to its sys path - and apparently there > are things in /usr/local which are inconsistent with those at /usr > (not suprising). > > I have fixed the problem - but I had to modify the actual update- > manager .py file itself. At the beginning, I set the sys.path in > python *explicitly* to not include the /usr/local stuff. > > But this is clearly a kludge. My question: how do I keep the Ubuntu > python stuff at /usr/bin/python2.5 from adding /usr/local/lib/ > python2.5 to the import search path in a clean and global way? I > really want both pythons completely isolated from one another! > > Thankyou. Python's path is build by site.py. In the file /usr/lib/python2.5/ site.py, look for the line "prefixes.insert(0, '/usr/local')" and comment it out. That should do it. casevh -- http://mail.python.org/mailman/listinfo/python-list
Re: Python with Ecmascript
Hi! Ecmascript (Jscript) is Active-Scripting compliant. With PyWin32, you can : - call JScript functions (with parameters) - define pieces of code (& run it) Another way, is to drive Internet-Explorer (via COM). You can set the IE-Windows as invisible, and connect the motor of execution (of JScript). Then, you can : - call JScript functions, with parameters et return ; variables, but also array (<=> lists) - connect to JScripts's objects (for read/write) - write new functions in JScript - etc. @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list
Re: pythoncom InternetExplorer.Application don't work in vista || firefox pythoncom ?
Hi! Your code run OK for me (Vista Ultimate). This other version run also OK : def webbrowser(url=None): import win32com.client, time ie=win32com.client.Dispatch('InternetExplorer.Application') while ie.Busy==True: time.sleep(0.125) ie.Top = 0 ie.Left = 0 ie.Height = 400 ie.Width = 400 ie.AddressBar = False ie.MenuBar = False ie.Resizable = False ie.StatusBar = False ie.ToolBar = False ie.Visible = 1 return ie w = webbrowser() w.Navigate('http://www.google.nl') @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list
Re: Singleton implementation problems
Great! Thanks everyone for so many references and comments. Lots of doubts have been solved. On Fri, Jul 4, 2008 at 10:33 AM, Peter Otten <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: > >> Peter Otten <[EMAIL PROTECTED]> writes: >> >>> The problem is the structure of your program. The myset module is >>> imported twice by Python, once as "myset" and once as "__main__". >> >> Yes, this is the problem. Each module imports the other. >> >>> Therefore you get two distinct MySet classes, and consequently two >>> distinct MySet.__instance class attributes. >> >> Are you sure? This goes against my understanding: that 'import foo' >> will not re-import a module that's already been imported, but will >> instead simply return the existing module. > > The main script is put into the sys.modules cache as "__main__", not under > the script's name. Therefore the cache lookup fails. > >> So, I think if one evaluated 'myset is __main__', you'd find they are >> exactly the same module under different names; and therefore that >> there is only *one* instance of 'MySet', again under two names. > > No: > > $ cat tmp.py > import tmp > import __main__ > > print tmp is __main__ > > $ python tmp.py > False > False > > Peter > -- > http://mail.python.org/mailman/listinfo/python-list > -- Saludos Juan Carlos "¡¡Viva lo rancio!!" -- http://mail.python.org/mailman/listinfo/python-list
Re: Python with Ecmascript
> Ecmascript (Jscript) is Active-Scripting compliant. > With PyWin32, you can : > - call JScript functions (with parameters) > - define pieces of code (& run it) > > Another way, is to drive Internet-Explorer (via COM). You can set the > IE-Windows as invisible, and connect the motor of execution (of > JScript). Then, you can : >- call JScript functions, with parameters et return ; variables, but > also array (<=> lists) >- connect to JScripts's objects (for read/write) >- write new functions in JScript >- etc. Is there a way to do similar things on linux? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list
Re: perl + python tutorial available for download
On Tue, 01 Jul 2008 12:02:24 +, Ben Bullock wrote: > I'm a big fan of code samples - most of my code starts as other people's > code samples. What I think is missing, Xah, is that the actual result. I.e, showing that "you can do this" only covers less than half of the tutorial, showing what the result is is more important. -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
Mark Dickinson wrote: On Jul 5, 1:54 pm, Carl Banks <[EMAIL PROTECTED]> wrote: Part of the problem is a lack of agreement on what 'regular expression' means. Twenty years ago, there was. Calling a extended re-derived grammar expression like Perl's a 'regular-expression' is a bit like calling a Hummer a 'car' -- perhaps to hide its gas-guzzling behavior. Strictly speaking, PCREs aren't regular expressions at all, for some values of the term 'regular expression'. See http://en.wikipedia.org/wiki/Regular_expression -- http://mail.python.org/mailman/listinfo/python-list
Re: pythoncom InternetExplorer.Application don't work in vista || firefox pythoncom ?
[EMAIL PROTECTED] wrote: H! I using a script that opens a internet page in a small window (what I can control) In XP everything was working fine, but now I'm using Vista with IE7 and this is what happends now: First a small window opens at the postion x0 y0 (like I want) but then IE thinks "Hey lets open a other main window too". And that window opens the url 'http://www.google.nl' Perhaps on XP you changed the IE homepage to about:blank. On your Vista machine, it is set to Google, perhaps by the manufacturer (for a fee). Try changing it. -- http://mail.python.org/mailman/listinfo/python-list
Re: re.search much slower then grep on some regular expressions
Terry Reedy <[EMAIL PROTECTED]>: > Mark Dickinson wrote: >> On Jul 5, 1:54 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > >> Part of the problem is a lack of agreement on what >> 'regular expression' means. > > Twenty years ago, there was. Calling a extended re-derived grammar > expression like Perl's a 'regular-expression' is a bit like calling a > Hummer a 'car' -- perhaps to hide its gas-guzzling behavior. Yet, to many programmers the Hummer is not only just a car, its _the_ car. Everything else is just silly, bloody old posix crap ;) (meaning, that pcres are often seen as true regular expressions, and everything else is referred to as "being somehow restricted") -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: Boost Python - C++ class' private static data blown away before accessing in Python?
In Python, I retrive an Entity from the EntityList: elist = EntityList() elist.append(Entity()) elist.append(Entity()) entity = elist.get_at(0) entity.foo() But it crashes inside foo() as the private static data is empty; or rather the string array is empty. I know before that point that the private static data is valid when accessed earlier by the C++ code as the program works fine. It just won't work from Python, so somehow the private static data has been blown away but I can't work out where or why. Probably it is a problem of lifetime. What is the signature of append? Who deletes the appended Entity in C++ code? If append takes a raw pointer, Boost.Python copies the pointer but destroys the Entity object because it is a temporary and its reference count went to zero. So the pointer in the list is referring to a destroyed object, which results in undefined behaviour. Did you have a look at the lifetime policies of Boost.Python? The simplest way to workaround the problem is using const reference arguments, and always use value semantics. If it can result in a performance penalty, another simple way is using shared_ptr's, which have their own reference count (different from the one in CPython lib), but Boost.Python does the magic to make them work together. HTH, Giuseppe -- http://mail.python.org/mailman/listinfo/python-list
Re: win32com.client (Howto edit Contacts in Outlook)
"Bill Davy" <[EMAIL PROTECTED]> wrote: > >I am trying to edit Contacts in Outlook. This is so I can transfer numbers >from my address book which is an Excel spreadsheet to my mobile phone. Are you actually running Outlook? Your news posting was made from Outlook Express, and Outlook Express cannot be controlled by COM (although MAPI works). -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python with Ecmascript
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >for my Python application (Windows platform) to be standards >compliant, I need to embbed Ecmascript(Javascript) interpreter - I >need to execute plugins written in this language. What standard are you hoping to comply with? I mean, what kind of a program is this? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python with Ecmascript
Hi! Is there a way to do similar things on linux? I think no. Because these tech use COM. And COM don't exist under xxnux. But: - look if XPCOM, or dBus) can help you - search with the word "MOZLAB", who work a solution (plugin) for drive Firefox, from an external software. Good luck! -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list