[Tutor] Having trouble with a component of the random module

2008-08-27 Thread Alan Gilfoy
One of my for-fun Python products is a booster-pack generator for trading card games (specifically, Magic the Gathering, the one game of the genre that I play heavily) Somewhat like baseball cards, the cards in a pack are a somewhat-random selection of cards from the set in question, broken

[Tutor] print the hole unicode list

2008-08-27 Thread Yang
Hello, I am trying to print out the hole unicode char list in window! form 0-65535. I use the winxp in simple chinese LOCAL! the ascii form 0-127 and CJK chars form 0X4E00-0X9FA4 can be print out! Other ucode chars case this error "UnicodeEncodeError: 'gbk' codec can't encode character u'\u9fa6

Re: [Tutor] using sys.excepthook to handled unhandled exceptions

2008-08-27 Thread Alan Gauld
"Tony Cappellini" <[EMAIL PROTECTED]> wrote With that in mind, I thought I would add a handler which logs the tracebacks to a file, display a 1-line message about the error on the screen, so the user has some idea of what happened, along with a simple message like this I tend to do that afte

Re: [Tutor] Working with IDLE in XP, Set Up for A New Program

2008-08-27 Thread Alan Gauld
"Wayne Watson" <[EMAIL PROTECTED]> wrote would like to know if there's an easier way to start it than what I use? I pick on a py file, and then use the pull down menu, right-click, to select IDLE. Yes, it should be on the Start menu possibly listed as Python GUI. Or you can set up a short

Re: [Tutor] using sys.excepthook to handle unhandled exception (corrected and reposted)

2008-08-27 Thread Kent Johnson
On Wed, Aug 27, 2008 at 3:18 PM, Tony Cappellini <[EMAIL PROTECTED]> wrote: > I would like to hear from the experiences of people "who have assigned > an exception handler function to sys.excepthook" as to how they > approached > this problem. More specifically, what issues they encountered, if an

[Tutor] using sys.excepthook to handle unhandled exception (corrected and reposted)

2008-08-27 Thread Tony Cappellini
I'm maintaining a large framework of python code where the original authors left many assert statements. When an unhandled exception occurs, the traceback is displayed on the screen. Ideally, I don't want the users to see the tracebacks from unhandled exceptions, but rather a short, useful message

[Tutor] using sys.excepthook to handled unhandled exceptions

2008-08-27 Thread Tony Cappellini
The original authors left asserts in many places and I don't want the people using the code to see the ugly tracebacks. want to add an unhandled exception handler to a large framework that I'm maintaining, to make the applications behave better, Users of a program shouldn't need to know anything

Re: [Tutor] Working with IDLE in XP, Set Up for A New Program

2008-08-27 Thread Samir Parikh
On Wed, Aug 27, 2008 at 11:36 AM, Wayne Watson <[EMAIL PROTECTED]> wrote: > I use IDLE on XP, and would like to know if there's an easier way to start > it than what I use? I pick on a py file, and then use the pull down menu, > right-click, to select IDLE. That means I start off with some program

[Tutor] Working with IDLE in XP, Set Up for A New Program

2008-08-27 Thread Wayne Watson
Title: Signature.html I use IDLE on XP, and would like to know if there's an easier way to start it than what I use? I pick on a py file, and then use the pull down menu, right-click, to select IDLE. That means I start off with some program I may want to erase to get started on a new program. I

Re: [Tutor] renumbering a sequence

2008-08-27 Thread Paul McGuire
One problem with my previous post. I didn't look closely enough at the original list of files, it turns out you have multiple entries for some of them. If you used the glob module to create this list (with something like "original_list = glob.glob('frame.*.dpx')"), then there should be no problem

Re: [Tutor] renumbering a sequence

2008-08-27 Thread Paul McGuire
I am thinking along similar lines as Simone, but I suspect there is still a missing step. I think you need to know what the mapping is from old name to new name, so that you can do something like rename or copy the files that these names represent. Python's built-in zip() method does the trick he

Re: [Tutor] renumbering a sequence

2008-08-27 Thread Alan Gauld
"Christopher Spears" <[EMAIL PROTECTED]> wrote ordered_list = sorted(unordered_list) test_frame_1 = ordered_list[0].split('.')[1] test_frame_2 = ordered_list[1].split('.')[1] if test_frame_1 == "": if test_frame_2 =! "0001": print "Sequence needs to be renumbered" for frame in