Re: python shell

2007-05-19 Thread Peter Anderson
Krypto wrote:
> I have been using python shell to test small parts of the big program.
> What other ways can I use the shell effectively. My mentor told me
> that you can virtually do anything from testing your program to
> anything in the shell. Any incite would be useful.
> 

I'm not sure this will help - but!

I use a text editor (EditPlus under Windows) as a mini IDE.  Some text 
editors have a concept of "tools" where you can run the "tool" from 
within the editor and it calls an external program to run the source 
code in the editor.  With EditPlus the tool looks something like:

Menu text: Python
Command: C:\Python25\python.exe
Argument: "$(FileName)"
Initial directory: $(FileDir)
Capture output: [X]

Output from the program run is captured in an "output window".  A full 
blown IDE it ain't but handy it is.

Regards,
Peter
-- 
Peter Anderson

There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things — Niccolo Machiavelli, "The 
Prince", ch. 6
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what IDE is the best to write python?

2009-02-02 Thread Peter Anderson
I have a "thing" about editors; a good editor is my tool of trade! I 
have tried many editors over the years mainly in the MS Windows, Linux 
and IBM mainframe environments. After all this I really like EditPlus 
(and the a slightly lesser extent Textpad). What both have in common is 
their "Clip Library" or "Clip Text" (I think its called in Textpad).


A Clip Library is a simple text file that appears in a side panel next 
to the main edit panel. Double click on a Clip Library element and it is 
automatically pasted into the edit panel at the current cursor position. 
The Clip Library content can also be pased around highlighted text in 
the edit panel.


Here is a simple of an EditPlus Clip Library for what I call a "short 
script":


#T=Short script
^# ^!.py
^# The purpose of this script is

def main():
{code here}

main()

#T=Next Clip Library element


#T= defines the name of the Clip Library element

^# the "^" character must proceed a character that is normally a Clip 
Library syntax character but which you want to use in another context (a 
Python line comment in this case)


^! is the cursor positin after the Clip Library element has been 
inserted, in this case the cursor is positioned to alloy the name of the 
script to be typed


The Clip Library element ends when the Clip Library "parser" finds 
either another element definition or the end of the file.


Clip Libraries are stored in simple text files.

This is such a simple concept but is so very productive. Who needs an 
IDE?. I would love to have a Linux text editor (like Scite or GEdit) 
that could do this.


Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Python 3 and easygui problem

2009-02-21 Thread Peter Anderson
I have just installed Python 3. I have been using Tkinter and easygui 
(with Python 2.5.4) for any GUI needs. I have just started to port some 
of my existing scripts to Python 3 and discovered problems with easygui.


I was using the following script for testing:

from easygui import *
import sys

while 1:
msgbox("Hello, world!")

msg ="What is your favorite flavor?"
title = "Ice Cream Survey"
choices = ["Vanilla", "Chocolate", "Strawberry", "Rocky Road"]
choice = choicebox(msg, title, choices)

# note that we convert choice to string, in case
# the user cancelled the choice, and we got None.
msgbox("You chose: " + str(choice), "Survey Result")

msg = "Do you want to continue?"
title = "Please Confirm"
if ccbox(msg, title): # show a Continue/Cancel dialog
pass # user chose Continue
else:
sys.exit(0) # user chose Cancel

I have changed the easygui source to Python 3 'import' and 'print' 
requirements and the initial message box in the above script displays 
fine fine. However the subsequent message boxes do not display and after 
the script completes I get the following error message:


-- Python 3 --
Traceback (most recent call last):
File "easyguidemo.py", line 10, in
choice = choicebox(msg, title, choices)
File "C:\Python30\lib\site-packages\easygui.py", line 703, in choicebox
return __choicebox(msg,title,choices,buttons)
File "C:\Python30\lib\site-packages\easygui.py", line 824, in __choicebox
choices.sort( lambda x,y: cmp(x.lower(), y.lower())) # case-insensitive sort
TypeError: must use keyword argument for key function

Output completed (7 sec consumed)
--

Fixing this is a bit beyond my skills and I was wondering whether anyone 
has any thoughts.


I am happy to post a copy of my revised easygui.py script.

Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3 and easygui problem

2009-02-22 Thread Peter Anderson

Gabriel Genellina said:

That's very short-lived; cmp is gone in 3.0.1 (should not have existed in 3.0 
in the first place).
Try with:
choices.sort(key=str.lower)


Gabriel,

That's worked fine - thank you. I think I now have a version of 
easygui.py that works with Python 3, probably needs a bit more testing.


Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3 and easygui problem

2009-02-22 Thread Peter Anderson

John Machin said:

Has the OP tried to contact the author/maintainer of easygui [the
usually-recommended approach to problems with not-widely-used third-
party modules]?

Don't you think the author/maintainer might like to be consulted
before you incite an OP to claim-jump his package name on PyPI?

The OP (I presume you mean me) has tried to contact Steve Ferg (the 
original developer) but I have not had a reply yet. See my e-mail above; 
it is NOT my intention to place my modified script on PyPI as I AM NOT 
the original developer. My claim to fame is changing a few "import" and 
"print" statements and getting some useful advice from other members of 
this list.


I am happy to make my modified script available unofficially and if 
Steve does contact me I would prefer to pass it on to him for his 
consideration.


This little project started out to solve a personal need not to 
plagiarise or usurp the rights and skills of another developer. I was 
happy to make my simple effort available, unofficially, in return for 
help from other list members.


I hope that resolves the issue.

Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3 and easygui problem

2009-02-22 Thread Peter Anderson

Terry,

I have not used PyPI before and feel a little uneasy about putting this 
modified script into such a public place. I have previously contacted 
Steve Ferg (the original developer of EasyGui) but have not had a reply. 
Clearly the bulk of the work is his still where as the modifications are 
mine (and several helpers from the Python List).


Until I work out what I ought to do I have attached a copy of my script 
(and the test script I have been using) as is. I would really appreciate 
any comments. If Steve does not reply and further testing proves my 
modified script is sound then I will certainly look at a 'public' release.


Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6


--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3 and easygui problem

2009-02-22 Thread Peter Anderson

John Machin said:*

*"... the knowledge that you had attempted to contact Steve Ferg and 
have not yet had a response was not available on c.l.py and in any case 
is not a justification for incitement to hijack."


John, I resent the implication that I am trying to hijack Steve's 
project. This was never my intention. I am uneasy about posting this 
rebuttal on the list as this is not what I think lists like this are 
for; but given your response I will post this one reply in my defence. I 
think that if you want to follow up this matter do it off line.


For your information I have since been in contact with Steve and sent 
him a copy of my code. Its been my experience that there are some users 
of these lists who ought to hesitate before they jump in because they 
often are not in full possession of all the facts.


Once again (and for the last time) this was a personal project, I 
offered to share my additions to Steve's work in an informal way to 
anyone who helped me with fixing error responses I was getting - its a 
very long bow to draw to say this constitutes hijacking. It was NEVER my 
intention to hijack anyone's work and I resent the accusation.


To end, I have included below a statement that I added to the script 
that I sent to Terry:


-
This is an experimental version of EasyGui that has converted the latest
'official' version so that it will run under Python 3.0.1
The script is still being tested and any comments would be appreciated.

NOTE: This version of the script is not from Steve Ferg although his
contribution of the original script is acknowledged. This script is
released under the same Creative Commons Attribution 2.0 License as the
original script.
Modified by: Peter Anderson
Date: Monday, 23 February 2009
Contact: peterjohnander...@gmail.com
-

As far as I am concerned that is the end of the matter on this list. 
Feel free to contact me off line if you want to follow up this post.


Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: Emacs vs. Eclipse vs. Vim

2008-12-01 Thread Peter Anderson
What I have done is skipped the whole Vim/Emacs obscure editor thing and 
opted for PyScripter (see 
http://mmm-experts.com/Products.aspx?ProductID=4 ). It might not be as 
complete/complex as these other editors but it is easy to use and just 
lets me get on with the task of cutting code.


As a fall-back I also use EditPlus (see 
http://www.editplus.com/index.html ). Its only for Windows and its 
shareware so you need to pay for it. Its clip library makes it a VERY 
GOOD text editor. It's a real shame there are NO text editors with such 
a comprehensive and easy to modify clip library function (I would be 
really pleased to be proven wrong on this last point :-) ).


However, the best advice I think that can be given about editors is keep 
trying them until you find the one YOU like. We all like different 
things, especially when it comes to editors.


Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: Emacs vs. Eclipse vs. Vim

2008-12-01 Thread Peter Anderson

Stef asked:

/
/>/ As a fall-back I also use EditPlus (see 
/>/ http://www.editplus.com/index.html ). Its only for Windows

/but PyScripter is also only for windows ;-)
/ and its shareware so you need to pay for it. Its clip library makes it 
/>/ a VERY GOOD text editor. It's a real shame there are NO text editors 
/>/ with such a comprehensive and easy to modify clip library function (I 
/>/ would be really pleased to be proven wrong on this last point :-) ).

/What so great about it ?

I think you would really need to try it.  As I said yesterday,
I find the clip library really very useful; its simple to use
and easy to create/extend.

Here is a short piece of clip library from a HTML clip lib:

#T=Bold
^!
#T=Italic
^!
#T=Underline text
^!
#T=Superscript (end note)
^!
#T=Code fragment
^!
#T=Highligt text - yellow
^!
#T=Centre text

^!


Only the text on the line after the "T#" appears in the clip lib side panel.
Double click on the text label and EditPlus inserts the clip text into the
document being edited.  The "^!" is where the cursor sits after the clip
insertion.  Clips can be inserted "around" existing text.

Very neat; if you use Windows its really worth a try.

Regards,
Peter

--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: IDE Question

2008-10-16 Thread Peter Anderson

I have been using the two following Python IDE's on both Windows and Ubuntu:

   * PyScripter - http://mmm-experts.com/
   * DrPython - http://sourceforge.net/projects/drpython/

PyScripter is, I think, the better but both are nice editors and easy to 
use.


Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: What IDE support python 3.0.1 ?

2009-04-24 Thread Peter Anderson

Sam (I presume),

Like you I am also in the process of learning to program in Python. I 
have been using Python 2.5.2 for quite some time but recently made the 
switch to 3.0.1. Why? Because I read an article where Guido van Rossum 
himself recommended that anyone starting out learning Python now was 
wasting their time if they didn't start with Python 3. Some folks on 
this list will tell you there is not much difference and that seems to 
be true but I pleased that I made the switch.


Now for your question about an IDE. I am presuming you are just 
beginning, perhaps done some programming in another language and 
probably using a Windows based PC. Given that there are some things I 
would recommend you stay away from (this will get the juices going :-) 
): Vi, Vim, Emacs and all those old fashioned UNIX/Linux based editors - 
they are just too hard and why bother anyway, there are much more 
civilised ways of proving your manhood. Eclipse is also an over-kill. I 
would recommend any of the popular text editors; most will recognise 
Python files.


I can tell you what I use:
*EditPad+* - http://www.editplus.com/index.html - A great general 
purpose text editor that has the additional benefit of clip libraries 
(what?). This might not seem important but it is a great time saver. A 
clip library is a text file of code snippets that when you 
'double-click' the required clip the editor inserts that code at the 
current cursor position. For example the following is a clip I use for 
the heading of a short script file:


#T=Short script
^# ^!.py
^# The purpose of this script is

def main():
{code here}

main()

After the clip has been inserted the cursor is positioned where the "^!" 
string is (before ".py") waiting for the script name to be inserted. You 
just build these clips to suit yourself. TextPad is another text editor 
with the same features.


The main drawback with EditPlus is that when you run a Python script 
from within EditPlus and that script uses stdin (eg. an input() 
function) the editor can't handle it and you get an error message. I 
overcome this problem by using easygui (http://easygui.sourceforge.net/) 
dialogs for text input; a piece of cake :-) . Another drawback is that 
EditPlus is shareware and you have to pay for it (US35).


*SciTE* - http://www.scintilla.org/SciTE.html - Scite is a very good 
little editor, it does not have the "bells and whistles" that editors 
like EditPlus have but it does recognise Python files and can run them 
from within the editor. It can also handle stdin (not that elegantly, 
but it works) so you don't need the easygui work-around and its free.


*IDLE* - the built-in Python IDE. I have it configured so that the 
editor panel loads first rather than the Python prompt. Everything runs 
in IDLE!


*PyScripter* - http://code.google.com/p/pyscripter/ - From the web site: 
"PyScripter is a free and open-source Python Integrated Development 
Environment (IDE) created with the ambition to become competitive in 
functionality with commercial Windows-based IDEs available for other 
languages." This is a true IDE with most of the things you would expect. 
However, I find that it gets a bit buggy at times. It does support 
Python 3 and is free so its worth a try.


There are several other good Python editor/IDE's but they require 
wxPython and it has not yet been made available in a Python 3 compatible 
version.


I hope that helps. Give me a reply if you want any more help with any of 
these things. Easygui is something that is really worth getting to know. 
A copy of Python (Second Edition) by Toby Donaldson (ISBN 13: 
978-0-321-58544-8) is another good thing to have when you are learning.


Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Python internals

2008-07-15 Thread Peter Anderson
Hi!  I am slowly teaching myself Python.  I was reading David Beazley's 
excellent book "Python - Essential Reference"; in particular about 
variables.  Let me quote:


"Python is a dynamically typed language in which names can represent 
values of different types during the execution of a program. In fact the 
names used in the program are really just labels for various quantities 
and objects. The assignment operator simply creates an association 
between a name and a value. This is different from C, for example, in 
which a name (variable) represents a fixed size and location in memory..."


As an old mainframe programmer, I understand the way C does things with 
variable but this text got me wondering how Python handles this 
"association" between variable name and value at the lower level.  Is it 
like a fifo list?


If there is any Python guru that can help I would be most interested in 
your thoughts.


Regards,
Peter
--
Peter Anderson

There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things -- Niccolo Machiavelli, The 
Prince, ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Python internals question

2008-07-15 Thread Peter Anderson
Hi! I am slowly teaching myself Python. I was reading David Beazley's 
excellent book "Python - Essential Reference"; in particular about 
variables. Let me quote:


"Python is a dynamically typed language in which names can represent 
values of different types during the execution of a program. In fact the 
names used in the program are really just labels for various quantities 
and objects. The assignment operator simply creates an association 
between a name and a value. This is different from C, for example, in 
which a name (variable) represents a fixed size and location in memory..."


As an old mainframe programmer, I understand the way C does things with 
variable but this text got me wondering how Python handles this 
"association" between variable name and value at the lower level. Is it 
like a fifo list?


If there is any Python guru that can help I would be most interested in 
your thoughts.


Regards,
Peter
--

Peter Anderson

There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things — Niccolo Machiavelli, /The 
Prince/, ch. 6


--
http://mail.python.org/mailman/listinfo/python-list


Re: Python internals

2008-07-15 Thread Peter Anderson

Ben Finney wrote:

Larry Bates <[EMAIL PROTECTED]> writes:

The term "pointer" carries much extra baggage for a programmer
thinking of C (as the original poster is)...


Thanks everyone!  Just a quick correction - "as the original poster is" 
is a bit of a jump that does not reflect my original question. I DO 
understand how C and other programming languages handle variables 
internally (the bits of actual memory reserved, etc. etc.) and that's 
why I asked the question in the first place.


If Python doesn't do it like C and the others then what mechanism does 
it use - it's the sort of issue that helps me understand how the 
language is interacting with the underlying operating system/hardware.


By way of background, in my ancient working days I looked after 
mainframe systems written in COBOL and Natural (and some assembler which 
I never had to support personally but my staff did).  I found that most 
programmers write bad code because they don't understand what the 
machine is doing with their code.  Probably doesn't matter any more but 
old habits die hard! ;-)


Regards,
Peter
--
Peter Anderson

There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things -- Niccolo Machiavelli, The 
Prince, ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python internals question

2008-07-15 Thread Peter Anderson

Helmut Jarausch wrote:


Please have a look at
...
http://rg03.wordpress.com/2007/04/21/semantics-of-python-variable-names-from-a-c-perspective/ 



Helmut,

I found the second reference (the one above) very useful thank you. 
Most other respondents to my original question did not seem to 
understand what I was asking or didn't read the question and simply 
proceeded to re-state what I had quoted from Beazley - well I understood 
what he was saying, I simply wanted to find out how Python did it at a 
lower level.  Your reference answered the question ;-)


Thanks,
Peter
--
Peter Anderson

There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things -- Niccolo Machiavelli, The 
Prince, ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Python Written in C?

2008-07-21 Thread Peter Anderson
> Bah, new-fangled languages like Pascal... Real programmers write 
Fortran. Using punch-cards and paper-tape. Real programmers can edit 
their programs with a pointy stick and some home-made sticky-tape. -- 
Grant Edwards


Reminds me of a funny story from my past working life. I had this fibre 
tipped pen, given to me as a freebie by some computer company. The pen 
had something like "Floppy Disk Pen" printed down the barrel. A 
colleague who was more into IT management than programming or hands-on 
support picked it up at a meeting and said something like - "That's 
interesting, what's it for?" Seeing an opportunity I replied "Its a new 
bit of technology that allows you to write directly to your floppy disks 
when you are away from your computer!" "What a great idea!" he replied 
in all seriousness!


Maybe our friend could find one to code C# with! ;-)

Peter
--

Peter Anderson

There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things — Niccolo Machiavelli, /The 
Prince/, ch. 6


--
http://mail.python.org/mailman/listinfo/python-list


RE: very newbie question

2008-08-07 Thread Peter Anderson

Try this:

# The player tries to guess it and the computer lets
# the player know if the guess is too high, too low
# or right on the money

import random

print "\tWelcome to 'Guess My Number'!"
print "\nI'm thinking of a number between 1 and 100."
print "Try to guess it in as few attempts as possible.\n"

# set the initial values
the_number = random.randrange(100) + 1
tries = 0

def ask_number():
guess = int(raw_input("Take a guess: "))
tries = 1

while (guess != the_number):
if (guess > the_number):
print "Lower..."
else:
print "Higher..."
tries += 1
guess = int(raw_input("Take a guess: "))
tries += 1

ask_number()

print "You guessed it! The number was", the_number
print "And it only took you", tries, "tries!\n"

raw_input("\n\nPress the enter key to exit.")

The variables "the_number" and "tries" were not available outside the 
"ask_number()" module.


Alternatively drop the def function and lump it all into a simple script.
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: programming toolbox

2008-08-22 Thread Peter Anderson

Bill Purcell said:
"... I was wondering what more experienced programmers think about what 
languages are necessary to be able to handle most programming problems. ..."


Bill,

I have a similar length of experience with python to you. I look at 
other languages from time to time but the only two I think are worth the 
effort are:


* PHP - because I do a bit od WordPress website work for some 
not-for-profits; and
* Java - because I don't know why but having done C and some mainframe 
based languages (Natural and COBOL) when I worked the portability of 
Java (and PHP and Python) appeal to me.


Java is a "that look's interesting" propositioned while I am learning PHP.

If I were programming for a living and working on my own I would look 
very seriously at X-Base languages (dBase is still available) as they 
are quite good for small business type projects - quick to code and 
(more importantly) maintain, easy to produce screens and part of the 
underlying data storage system - not fashionable but very productive.


Biggest issue I have with Python is screen input and output. I am trying 
to master wxPython (and Tkinter) but find this aspect harder than it 
ought to be.


While I'm rambling on; I recently purchased "Python Programming: An 
introduction to Computer Science" by John Zelle (ISBN: 1-887902-99-6) a 
really good book, best Python text I have read.


Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: Books about Python.

2008-08-24 Thread Peter Anderson

Hi!

I am currently working my way through "Python Programming: An 
introduction to computer science" by John Zelle. Published by Franklin, 
Beedle & Associates. ISBN: 1-887902-99-6. Book's home page: 
http://www.fbeedle.com/99-6.html


I have a small but quite good Python library and this is the best Python 
(actually best programming) book I have ever read. It is written as a 
text for a first year (US) college level course. Python is used because 
experience with other languages showed that their learning curves got in 
the road of the primary function of the course.


"Problem Solving With Algorithms And Data Structures Using Python" by 
Bradley N. Miller and David L. Ranum (ISBN-10: 1590280539 or ISBN-13: 
978-1590280539 Book's home page: http://www.fbeedle.com/053-9.html) is 
on my Amazon wish list to follow on from Zelle. This book is, as I 
understand it, a second year text. See the book's home page for content 
details.


I hope that helps,

Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


wxPython problem

2008-09-06 Thread Peter Anderson
I am trying to teach myself how to program in Python and use wxPython 
for GUIs. I am using PyScripter, IDLE and EditPlus as my IDEs. I have 
experienced an odd problem where I run a script once and it runs fine. 
Run it again and I get an error and the script fails.


If the script is run directly from Python ('Run' from Windows Explorer) 
or from EditPlus (in which I have a "user-defined tool" which calls 
C:\Python25\pythonw.exe with the parameter of $(FileName)) then there is 
*never* any error, no matter how many times the script is run.


Close down PyScripter or IDLE and then start either up again, load the 
script and run it - it runs fine. Run it again and it fails. It seems 
like something is already set in memory and cant be re-set (my lack of 
knowledge is showing here :-( ).


More details are shown below. Any help or hints would be greatly 
appreciated.


Regards,
Peter


RUNNING SIMPLE.PY (AND OTHER SCRIPTS USING WXPYTHON) FROM PYSCRIPTER I 
GET THE FOLLOWING ERROR MESSAGE:


PyNoAppError: The wx.App object must be created first!

PyScripter loads a module (I presume from wxPython) called _windows.py 
and highlights a particular line in red and displays the error message 
from above. I have Googled the error message but the results have not 
helped.



LISTING FOR SIMPLE.PY

#!/usr/bin/python

# simple.py

import wx

app = wx.App()

frame = wx.Frame(None, -1, 'simple.py')
frame.Show()

app.MainLoop()


EXERPT FROM _WINDOWS.PY - PYSCRIPTER HIGHLIGHTS SECOND LAST LINE

class Frame(TopLevelWindow):
"""Proxy of C++ Frame class"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), 
doc='The membership flag')

__repr__ = _swig_repr
def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, String title=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=DEFAULT_FRAME_STYLE, String name=FrameNameStr) -> Frame
"""

# The following line is highlighted as where the error occures

_windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
self._setOORInfo(self)


RUNNING THE SIMPLE.PY SCRIPT FROM WITHIN IDLE PRODUCES THE FOLLOWING 
ERROE MESSAGE:


Traceback (most recent call last):
File "C:\Documents and Settings\Peter\My Documents\Dev\Python\WxPython 
Tutorial\absolute.py", line 28, in 

Absolute(None, -1, '')
File "C:\Documents and Settings\Peter\My Documents\Dev\Python\WxPython 
Tutorial\absolute.py", line 9, in __init__

wx.Frame.__init__(self, parent, id, title, size=(250, 180))
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py", 
line 505, in __init__

_windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
PyNoAppError: The wx.App object must be created first!


--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython problem

2008-09-06 Thread Peter Anderson
Stef Mientki said: In PyScripter, you should run wxPython in the plain 
remote machine (not the wxPython remote),and you should set "reset 
before run flag" or reset the remote machine each time yourself.


Stef,

Thanks for the help! It has taken several hours to find and install the 
correct version of Rpyc (which is required to run the remote Python 
engine but it now seems to be working fine. And the "Reinitialise the 
Python engine {Alt]+[F2]" does need to be done between script runs. 
Given all that, the script now runs multiple times in PyScripter. The 
script still only runs ONCE in IDLE but I can live with that.


In case others find this message from a search; I am using Python 2.5.2 
and it requires rpyc-2.60.zip from the Rpyc download page (see 
http://rpyc.wikispaces.com/ click on the "Download" link and make sure 
you select the "main" link under the "Packages" column at Sourceforge. 
You will be shown a list of Rpyc versions. For Python 2.5.2 choose 
Relese "2.60". This will save you the several hours its cost me.


Thanks again Stef.

Regards,
Peter
--
Peter Anderson
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Re: Learning Python

2008-09-06 Thread Peter Anderson

James,

I have several Python books and am currently working my way through John 
Zelle's PYTHON PROGRAMMING: An Introduction to Computer Science 
(Publisher: Franklin, Beedle & Associates, ISBN-10: 1887902996, ISBN-13: 
978-1887902991). I think this is a very good introduction to both Python 
AND programming I would highly recommend it.


If you finish the Zelle book then you can go onto Problem Solving With 
Algorithms And Data Structures Using Python by Bradley N. Miller and 
David L. Ranum (Publisher: Franklin Beedle & Associates, ISBN-10: 
1590280539, ISBN-13: 978-1590280539).


These are equivalent to Python 101 and 201.

Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list


Mail delivery problems

2008-09-06 Thread Peter Anderson
In the last two days I have posted relies twice to the Python List. Each 
time my e-mail has listed successfully but I have received a reply like 
the following:


   This is an automatically generated Delivery Status Notification.

   Delivery to the following recipients failed.

   [EMAIL PROTECTED]

   

   Reporting-MTA: dns;delhi-prod01.india.kring.com
   Received-From-MTA: dns;kring-vt01
   Arrival-Date: Sun, 7 Sep 2008 07:16:17 +0530

   Final-Recipient: rfc822;[EMAIL PROTECTED]
   Action: failed
   Status: 5.2.2
   X-Display-Name: Ajay Deshpande


   Subject: Re: Learning Python
   From: Peter Anderson <[EMAIL PROTECTED]>
   Date: Sun, 07 Sep 2008 11:41:03 +1000
   To: python-list@python.org

   The text of my message...

Is this a problem?

Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to 
conduct, or more uncertain in its success, than to take the lead in the 
introduction of a new order of things—Niccolo Machiavelli, /The Prince/, 
ch. 6

--
http://mail.python.org/mailman/listinfo/python-list