Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-10 Thread EJP
Mike Hansen <[EMAIL PROTECTED]> wrote of an idle IDLE:

> That rooted out the problem. A while ago, I changed the colors to kind 
> of match my VIM color theme(ps_color). When I did 
> idlelib.PyShell.main(), IDLE came up with my custom color theme. 
> However, there was a bunch of warnings about my theme. From IDLE, I 
> deleted the theme. Now IDLE will launch normally. I'll set up the color 
> 
> theme later. Maybe older color themes aren't compatible with the newer 
> IDLE? The color theme must have been laying around. I didn't brute 
> force 
> it in or anything like that.
> 

> >IDLE is a
> >part of the Standard Library, so it's actually possible to try turning 
> on
> >individual pieces of it, one after the other.  Maybe that will help us
> >debug what's going on.
> >
> >Start up your console version of Python, and try:
> >
> >
> import idlelib.PyShell
> idlelib.PyShell.main()
> 


Just a +1 to Mike's problem (and the solution).  For sake of Googlers searching 
on error output (which I've done before), here are the errors I was getting on 
my machine when trying to launch IDLE.  Note, when I tried to open a .py file 
with IDLE the file would not open at all (and there were no error messages) - 
interesting that the whole process failed - is the missing error handling on 
the win or python side (no reason for these to have been fatal errors...)

Ah, now I can enjoy 2.4.  Thanks!

my error output (win32):


>>> import idlelib.PyShell
>>> idlelib.PyShell.main()

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-background'
 from theme 'sagecomments'.
 returning default value: '#ff'

 Warning: configHandler.py - IdleConf.GetThemeDict -
 problem retrieving theme element 'builtin-foreground'
 from theme 'sagecomments'.
 returning default value: '#00'

 Warning: configHandler.py - 

Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-20 Thread EJP

"Jacob S." <[EMAIL PROTECTED]>

> Gee,
> I think I'm going to burst out in tears.
> Mike Hansen gave the solution to the very problem I'm having, yet, when 
> I
> used the console version and deleted the custom color theme, it stopped
> giving me error messages, but it still won't start up without the 
> console.
> 
> I'm am still stunted of my python 2.4 experience.
> Help, please!!!
> 
> Desperate,
> Jacob


Can you open IDLE and reset the color options to the defaults?  I believe 
that's how I solved it.

If not, there should be some configuration files, plain text files with names 
like "*.def" in your idlelib directory.  Here's the path to one of several on 
my machine:  
C:\Python23\Lib\idlelib\config-highlight.def

I am not sure if you can safely delete these, but reverting them to the default 
configuration should work (I think).

Caution: I am not an expert in IDLE, Python, or... even life.

EJP

___
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Class within class, or...?

2005-01-25 Thread EJP
[sent previously, please ignore if already rec'd]


A basic OOP question, I guess.

I have a file from which I want to extract some data.  The data of
interest may be towards the end of the file at position A, defined by
schema A; or it may be in the file at variable positions near the
beginning of the file which are defined by a combination of schema B
and the data in the file; or the data of interest may be in the file
both ways (and the data may be different).

I'd like to write a class for the data extraction.  In my mind I'd
have one overall class for the data extraction with attributes for the
two possible sets of data extracted.  I am thinking It'd be nice if
these two attributes were two different classes themselves.  Something
like this:

class Reader:
   def __init__(self, filePath=""):
   try:
   self.fileObj=file(filePath,"r")
   except:
   self.errorMsg="File opening error"
   self.dataA=SchemaA()
   self.dataB=SchemaB()
   ...

class SchemaA():
   def __init__(self):
   self.data={}
   ...

class SchemaB():
   def __init__(self):
   self.data={}
   ...

I'm struggling with a mind stuck in functional programming mode and
also lazy from simple scripting, thus my questions:

-  Is there any problem with structuring my classes like this?  I
assume that using SchemaA and SchemaB within Reader would be no
different than using any other classes within that class (it all gets sorted 
out in compilation).

-  Is it possible, and is there any advantage to, embedding the
classes (SchemaA and SchemaB) within the Reader class?  The Schema
classes would not be used elsewhere.

-  Are there performance considerations to the structure I use?

Thanks in advance,

Eric


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Larger program organization

2005-02-12 Thread EJP



 "Ryan Davis" [EMAIL PROTECTED] wrote

  
  My 
  background is mostly C#, so I'm used to the ridiculous rigidity of 
  strongly-typed languages. I have been using python for helper apps for a few 
  months now, so am pretty familiar with the syntax now, but I don't know any of 
  the patterns yet.  My nefarious 
  goal is to supplant C#/ASP.NET with Python, but I need to figure out how to 
  make programs clients want to pay for before I can make any reasonable 
  argument.
 
without trying to make this one of 
those classic threads of great, do you feel you could develop fairly complex 
applications faster in Python than in C#/ASP.NET?  It's a rhetorical 
question (but I'm interested in your answer as a single data 
point)
 
Speed to market and hours/dollars 
of programming might resonate with some of your 
customers.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python in HTML

2005-05-21 Thread EJP

> Well, like I said, the darkplayer is on an online journal, which means 
> that the only output possible is modifying the option strings of songs 
> as they are played or something similar.  I do know that the random 
> number generator works, and the songs played always match the option 
> selected.  However, this was before adding the bit about copying the 
> songs and playing from the copy.  The last fully functional version 
> (without the 'play all songs once' feature) is as follows:
> 
>  codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701
>  
> type=application/x-oleobject height=0 standby="Loading Microsoft 
> Windows 
> Media Player components..." width=0 
> classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95>
>  


It's a bit off list topic, but I am interested to know how much functionality 
you have been successful to get going.  I tried something very similar with 
Quicktime and Javascript, but seemed to wind up at a dead-end.  My (premature?) 
conclusion was that once the audio player object was loaded, I could not reset 
certain parameters _in_that_object_  such as I would need to have it play an 
arbitrary file (url).

My javascript was successful in changing the page parameters, as verified with 
DOM and print statements, but there seemed nothing to trigger the audio player 
to recognize those new parameters.

IMO the great thing about Javascript is that you have a whole gui & application 
tied to it, so you can do a lot with very little code (sheer candy!); but the 
downside follows, that there you are utilizing a complex, fixed framework which 
constrains what you can do (bitter aftertaste)... and, of course, the 
development environment is not quite Pythonic.


I hope you can get your Javascript - Windows Media Player interface to work. 
Unfortunately, I do not know how Python could be used within that interface...

Good luck!



 
Eric Pederson
http://www.songzilla.blogspot.com


:::
domainNot="@something.com"
domainIs=domainNot.replace("s","z")
ePrefix="".join([chr(ord(x)+1) for x in "do"])
mailMeAt=ePrefix+domainIs
:::

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how to add python code to a webpage

2005-07-18 Thread EJP



Mustafa Abbasi asked:
 
i want to create a simple page which has a formand takes in 
persons date of birth and give out exact age.how do i add python codeto an 
html page.i don't have any dreamweaver or frontpage.this is basically 
cuz some freinds advised me to create this isnce i am learning programming 
python..so please help 
 
Mustfa, it sounds like you want a cgi script.  The Python 
script would reside on a server, and your webpage would send the form data to 
that script.  Often such script are kept in a "folder" called a 
cgi-bin.
 
You would want to get a basic understanding of "cgi" 
first.  You will find cgi mentioned both in Python documentation, and in 
Google search results for "cgi".
 
Good luck.
 
EP
 
 
 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor