Need Help on IDLE start up

2006-12-19 Thread TonyHa
Hello

I have install Python 2.5 under an user directory
"/user/dtgtools/packages/python/2.5"
after installation python works ok. but when I try "idle" I have the
following Error message:

** IDLE can't import Tkinter.  Your Python may not be configured for
Tk. **

I have read the README file it mentions the setup.py script should take
care of the TCl/TK setup.

but I wonder because our TCL/TCL is install under
"/user/dtgtools/packages/TCL/8.4"
how can I let ./configure know where to find Tcl/TK ? when installing
Python.

Thanks in advance!

Tony Ha.

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


Re: How to pass an argument to a python program open in IDLE?

2006-11-17 Thread TonyHa
Hello Josh,

Thanks for the reply. But I am not sure I understand your reply, may be
I need to explain my problem a bit more. I have a Python script which
needs an input argument to run.
e.g. python myscript.py xilinx. which run fine.

My problem is this: When I start IDLE GUI, then I open my script with
the edit window. (i.e.
File -> open). I run my script under the edit window using run -> run
module or F5. But IDLE does not allow me to input the argument to my
script, i.e. IDLE runs without prompting for the argument, then my
script fails. I wonder how can I pass the argument to my script under
IDLE?

Tony Ha.

[EMAIL PROTECTED] wrote:
> On Nov 15, 7:56 am, [EMAIL PROTECTED] wrote:
> > Hello,
> >
> > I have open a Python program in the IDLE, but when I select the "run
> > module" under "run" menu, it
> > does not allow me to pass an argument to my Python program!
> > How do you pass an argument to a Python program under the IDLE? Thanks for
> > you help!
>
> I'm using Python on an old Mac with the IDE.  I think my solution would
> work.
>
> opt_parser = OptionParser()
>
> def myfunc(argstring):
>   (self.options,self.args) =
> sub_opt_parser.parse_args(argstring.split())
>   f not self.args: self.args = "[default arguments]".split()
>   ...
>
> if __name__=="__main__":
>   myfunc(argstring)
>
>
> This means editing the file every time.  Since I'm on a Mac, I can also
> use:
> if __name__=="__main__":
>   from EasyDialogs import AskString
>   args = AskString('Options and Arguments')
>
>   myfunc(args)
>
> I'm not sure how easy this is to implement on other platforms
>
> Josh English
> [EMAIL PROTECTED]
> http://www.spiritone.com/~english

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


Re: Help with ConfigParser

2006-10-02 Thread TonyHa
Hello Peter,

Thanks for your help, and it works now!

Tony.

Peter Otten wrote:
> [EMAIL PROTECTED] wrote:
>
> > Question: How can I pervent ConfigParse to convert Upper case yo lower
> > case??, thanks.
>
> http://docs.python.org/dev/lib/RawConfigParser-objects.html
>
> """
> optionxform(option)
>
> Transforms the option name option as found in an input file or as passed in
> by client code to the form that should be used in the internal structures.
> The default implementation returns a lower-case version of option;
> subclasses may override this or client code can set an attribute of this
> name on instances to affect this behavior. Setting this to str(), for
> example, would make option names case sensitive.
> 
>
> If you don't pass defaults:
>
> config = ConfigParser()
> config.optionxform = str
> # ...
>
> Or, to be on the safe side:
>
> class MyCasePreservingConfigParser(ConfigParser):
> optionxform = str
> 
> config = MyCasePreservingConfigParser()
> # ...
> 
> Peter

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


Unix diff command under Window.

2005-08-24 Thread TonyHa
Hello,

Does any one have using Python to write a Unix "diff" command for
Window?

Tony Ha.

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


Re: PyPE 2.1 run problem

2005-08-18 Thread TonyHa

[EMAIL PROTECTED] wrote:
> Hello,
>
> I have downloaded the PyPE2.1-win-unicode.zip, after unzip it with winzip
> into PyPE2.1-win-unicode dierctory on window XP. I try to run "pype.exe"
> by double
> click on it, but nothing has happen, then when I run it with "run as..."
> using the right click button.
> I have the following Message in the pype.exe.log
>
> Traceback (most recent call last):
>   File "pype.py", line 30, in ?
>   File "configuration.pyc", line 129, in ?
> WindowsError: [Errno 267] The directory name is invalid:
> 'E:\\Downloads\\Python\\PyPE\\PyPE2.1-win-unicode\\library.zip/*.*'
>
> I also copy the "PyPE2.1-win-unicode" directory into
> "C:\Python24\Lib\site-packages" and run it, but it behaves the same !!
>
> Then I downloaded the source code and unzip it into "PyPe2.1-src", and run
> "python pype.py" in a command window.
> The progroam detected I have an older version of wxPython 2.5.5 and askes
> me do I want to download the newer version
> 2.6.1. Which I did.
>
> After downlowd the wxPython 2.6.1 (win-unicode" version). I installed it
> into Python 2.4.1, then re-run PyPE.
> i.e re-issue "python pype.py" in a command window." I have the following
> traceback Error message:
>
> [ Wed Aug 17 09:32:32 2005 ] Loading history from C:\Documents and
> Settings\gbr02333\.pype\history.txt
>
> Traceback (most recent call last):
>
>   File "pype.py", line 3926, in ?
>
> main()
>
>   File "pype.py", line 3916, in main
>
> filehistory.root = root = app.frame = MainWindow(None, -1, "PyPE",
> sys.argv[1+opn:])
>
>   File "pype.py", line 438, in __init__
>
> self.loadHistory()
>
>   File "pype.py", line 1152, in loadHistory
>
> self.config[nam][k] = dict(v)
>
> TypeError: iteration over non-sequence
>
>
> I wonder does anyone using PyPE2.1 on Windown XP SP2 and have the same
> problem? Can any one help
> with the problem? Thanks in advance !
>
> Tony Ha.

I have the following reply from the creator of PyPE (Josiah Carlson).
The
solution for running PyPE2.1 from the source is:

"replacing line 1152 with the following 4 lines:

if isinstance(v, dict):
self.config[nam][k] = dict(v)
else:
self.config[nam][k] = v "

Once I done the replacement as suggested above, PyPE2.1 can run from
the
source now. Thanks Josiah !

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