[Tutor] Starting a browser instance and passing a parameter to it.

2007-11-28 Thread Don Taylor
I am trying to start a browser from within a Python program and I want it to show a local file on my system and I want to pass a parameter to that browser page that will be picked up by some Javascript embedded in the page. I have this code: import webbrowser webbrowser.open("file:///D:/Eclips

Re: [Tutor] Starting a browser instance and passing a parameter to it.

2007-11-29 Thread Don Taylor
Alan Gauld wrote: > What are you using for the XML-RPC server? Doesn't that need to be a > web server of some sort anyhow? XML-RPC communicates using http... > I am using simpleXMLRPCServer. Yes, XML-RPC does use http as its transport protocol, but it does not have to run in the context of a

Re: [Tutor] Starting a browser instance and passing a parameter toit.

2007-11-29 Thread Don Taylor
Alan Gauld wrote: > Have you considered writing a small Java applet (maybe using Jython to > do so?) > that could communicate with the Javascript and send the XML-RPC stuff > to > your server? > Well, I am on a Procrustean bed here - Java is not available on one of my target platforms. > In

Re: [Tutor] Starting a browser instance and passing a parameter toit.

2007-11-29 Thread Don Taylor
Don Taylor wrote: > > First is to construct the apps opening web-page on the fly in the > XML-RPC server before the server instantiates the page. I can generate > some custom Javascript in this page that has the port number embedded > within it. Then the Javascript can store

Re: [Tutor] Starting a browser instance and passing a parameter to it.

2007-11-29 Thread Don Taylor
Kent Johnson wrote: > I can't decide if this is brilliant or crazy or both :-) Definitely crazy, but I hope both. In addition, I want to be able to run these apps on a Nokia Internet Tablet... > > I guess what you get from XMLRPC is an almost-free way to expose > functions to the browser. Y

Re: [Tutor] Starting a browser instance and passing a parameter to it.

2007-11-29 Thread Don Taylor
Eric Brunson wrote: > Definitely, or even just CGIHTTPServer. > No, I don't think so. I am not a RESTafarian. :-) Don. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Starting a browser instance and passing a parameter to it.

2007-11-30 Thread Don Taylor
Eric Brunson wrote: > Don Taylor wrote: >> Eric Brunson wrote: >> >> >>> Definitely, or even just CGIHTTPServer. >>> >>> >> No, I don't think so. I am not a RESTafarian. :-) >> > > Forgive my inexperience with t

[Tutor] function signatures for callbacks

2006-03-21 Thread Don Taylor
I have a piece of code that wants a callback from a client: The code looks like this right now: class pawprints: def __init__(self, callback_fun = None) ... at the client calling site I have something like this: def printme(modulename, codename, lineno, line): ... paws = pa

Re: [Tutor] function signatures for callbacks

2006-03-24 Thread Don Taylor
Danny: Thanks for this, I think that I can use this idea. When I first read your response I did not see how it helped me, but now I realise that it allows me to add some context to the exception message. I don't suppose that I can change the traceback to point at the definition of f2 instead o

Re: [Tutor] function signatures for callbacks

2006-03-24 Thread Don Taylor
Danny Yoo wrote: > > ### > ## Pseudocode for sending 'x' to every listener (untested) > class CallbackError(Exception): > pass > > for l in self.listeners: > try: > l(x) > except Exception, e: > raise CallbackErr

[Tutor] Doctest, object references and the use of ellipses

2006-04-01 Thread Don Taylor
Hi: I am trying to use Doctest and am having trouble using the ellipsis feature when trying to match an object reference. Here is the code: def add_change_listener(self, listener): ''' Returns list of listeners just for testing. >>> def mock_listener():

Re: [Tutor] Doctest, object references and the use of ellipses

2006-04-01 Thread Don Taylor
Kent Johnson wrote: > Don Taylor wrote: > >>Hi: >> >>I am trying to use Doctest and am having trouble using the ellipsis >>feature when trying to match an object reference. > > > What version of Python are you using? The ELLIPSIS comment was added in

Re: [Tutor] Python tutor

2006-04-01 Thread Don Taylor
Noufal Ibrahim wrote: > Greetings all, >Are there any programs for python that offer an "interactive" tutorial? > Something on the lines of the builtin emacs tutorial (which is While it is not really what you had in mind, I have just discovered the Python Challenge - and it is a lot of fun.

Re: [Tutor] Python tutor

2006-04-01 Thread Don Taylor
Alan Gauld wrote: > > I tried at one stage producing JavaScripted versions of the code in my > tutor where you could step through the code with the active line being > highlighted in colour - like a debugger. But after struggling for ages to > get > one short example to work it seemed too much l

Re: [Tutor] Doctest, object references and the use of ellipses

2006-04-01 Thread Don Taylor
Tim Peters wrote: > That "should work", provided there aren't differences in whitespace > that are invisible to us in this medium. For example, if, in your > source file, there's actually a (one or more) trailing space on your > line of expected output, then it would _not_ match the actual output

[Tutor] Version of a .pyc file

2006-04-18 Thread Don Taylor
I want like to write a script to scan all of the .pyc on my pythonpath to find out if they were built with Python 2.3 or 2.4. How can I tell if a .pyc file was built with 2.3 or 2.4? Thanks, Don. ___ Tutor maillist - Tutor@python.org http://mail.py

Re: [Tutor] Version of a .pyc file

2006-04-19 Thread Don Taylor
Terry Carroll wrote: >>How can I tell if a .pyc file was built with 2.3 or 2.4? > > > There's a "Magic Number" in the first 2 or 4 bytes, (depending on whether > you consider the \r\n part of the MN). > > f = open("pycfile.pyc", "rb") magictable = {'\x3b\xf2\r\n': "2.3", '\x6d\xf2\r\n

Re: [Tutor] Version of a .pyc file

2006-04-20 Thread Don Taylor
Kent Johnson wrote: > Don Taylor wrote: > >>Finally, are there any other possible file extension types that I should >>be looking at? > > > .pyo is like a .pyc but compiled with optimizations on. > Hi Kent: No, I really meant a .pyd file which is Python's

Re: [Tutor] Version of a .pyc file

2006-04-20 Thread Don Taylor
Terry Carroll wrote: > On Wed, 19 Apr 2006, Don Taylor wrote: > > >>But my underlying problem still occurs: somewhere somebody is calling >>for the 2.3 version of the Python vm .dll and not finding it. This is >>happening under Pydev/Eclipse and my only recourse

Re: [Tutor] GUI

2006-04-21 Thread Don Taylor
Eric Walker wrote: > Ok, > If I can get it for free, I might as well go with say wxPython. Thanks However, you really should spend a few bucks buying the recently published "wxPython In Action" book by Noel Rappin and Robin Dunn (the designer of wxPython). It will save you lots of time. You a

Re: [Tutor] Version of a .pyc file

2006-04-21 Thread Don Taylor
Terry Carroll wrote: > I've had some pretty good luck using Process Explorer, freeware from That did it, and it was a .pyd file that was giving me problems, thanks once again Terry. Process Explorer is _very_ nice and will certainly stay on my machine. Don. _

[Tutor] A Python idiom that I don't get

2006-04-25 Thread Don Taylor
I am trying to get some existing CPython 2.4 code working under Jython (2.1) and I am puzzled by a line in the following function. It seems to be a Python 2.4 idiom that is opaque to me. The line is: prefix = os.path.commonprefix(filter( bool, lines )) and I don't understand what that 'bo

Re: [Tutor] A Python idiom that I don't get

2006-04-26 Thread Don Taylor
w chun wrote: > it sounds like you did not develop the original code. it seems to > work... why are you trying to replace it? are you refactoring? No it is not my code. I am trying to get it running in Jython which does not support the bool function. I may refactor it after I get it working i

Re: [Tutor] Refactoring

2006-05-11 Thread Don Taylor
Philip Smith wrote: > This is a subject which seems to pop up periodically so apoliogies but I > wonder whether anyone can help: > > a)Is there yet an alternative Python refactoring tool to bicycle > repair man (bike)? > Find and Replace ;-) > b)If not is there any documentation on

Re: [Tutor] Fwd: eclipseplugin for python

2006-05-11 Thread Don Taylor
shivayogi kumbar wrote: > > > I downloaded python plugin for eclipse by directly downloading zip file > and extracting under eclipse folder; because it could not update via > PROXY. It was suggested to update plugins from eclipse IDE only. I am > unable to use that plugin(Python) in eclipse.

[Tutor] Data hiding in Python.

2006-12-18 Thread Don Taylor
I am working my way through 'wxPython in Action' by Noel Rappin and Robin Dunn and came across this comment about data hiding in their explanation of the MVC pattern: ".. the View... should never get to see the private internals of the Model. Admittedly, this is difficult to enforce in Python,

Re: [Tutor] MVC/MVP examples of how to implement it

2006-12-18 Thread Don Taylor
Basil Shubin wrote: > Hi friends! > > I have read articles about MVC/MVP, but still can't get a clue to how > implement it in really working application :-( Because I better > understand with ready to use examples, can you provide link to free > python+GUI application which implements MVC/MVP d

Re: [Tutor] MVC/MVP examples of how to implement it

2006-12-19 Thread Don Taylor
Basil Shubin wrote: > Hi friends! > > I have read articles about MVC/MVP, but still can't get a clue to how > implement it in really working application :-( Because I better > understand with ready to use examples, can you provide link to free > python+GUI application which implements MVC/MVP d

[Tutor] What is a mixin class?

2007-01-17 Thread Don Taylor
I have a vague idea what a mixin class is, I would like to get a better handle on it. It is a term that is used quite often in Python circles, but I can't find a definition. I guess that because of multiple inheritance Python does not need a formal way of specifying mixin classes so I presume

Re: [Tutor] What is a mixin class?

2007-01-17 Thread Don Taylor
Don Taylor wrote: > I have a vague idea what a mixin class is, I would like to get a better > handle on it. > Thanks for the information and the links, I have a much better idea about mix-ins now. I also found the following informative: http://www.linuxjournal.com/article/4540

[Tutor] Multi-line code that uses \ in doctest

2007-02-06 Thread Don Taylor
recent call last): File "C:\PYTHON24\lib\doctest.py", line 1243, in __run compileflags, 1) in test.globs File "", line 1 hexStringNums = ('1', '2', '3', '4', '5', '6',... '7', '8', '9','0')

[Tutor] What should go in a module?

2007-02-07 Thread Don Taylor
I am looking for advice on module size. When I first came upon Python my initial thought was to package very closely-related things into modules. Modules would be small, and may contain a single class or function. An application would consist of lots of modules. Now I am wondering if this is the

[Tutor] Generating pdf files in epydoc on Windows

2007-02-09 Thread Don Taylor
Does anyone know what is needed to install to get epydoc to generate pdf files on Windows. Besides epydoc itself of course. Thanks, Don. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Visual Basic versus Python.. What to choose??

2007-02-20 Thread Don Taylor
Asrarahmed Kadri wrote: > I want to develop an application which uses a database and some forms to > enter/modify the database. > The application should also generate reports based on some fields. > > What should I be using? Python or VB... That is both a religious question, and fighting words