Why Tcl/Tk?

2005-07-27 Thread Jerry He
I'm a little curious, why does most scripting
languges(i.e. python and ruby) use Tcl/Tk rather than
wx or Fox as its standard GUI? Although I did notice
that the Vpython IDE that uses Tkinker starts up a lot
faster than the DrPython IDE that uses wxpython. But
that makes no sense, Tk is based on Tcl, a scripting
language, but wx is written in C++. 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


functions without parentheses

2005-07-28 Thread Jerry He
Hi, 
  Is it possible to create a function that you can use
without parenthesizing the arguments? for example, for

def examine(str):
 .
 .

Is there some way to define it so that I can call it
like

examine "string" 
instead of examine("string")? 

thanks in advance

-Jerry




Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
-- 
http://mail.python.org/mailman/listinfo/python-list


installing SWIG for python

2005-08-06 Thread Jerry He
Hi, 
  I just installed SWIG on Windows(Cygwin) and tried
to use it to compile some of the example python
programs. 

For the first two commands it produced no error
swig -python example.i
gcc -c example.c example_wrap.c -I \
/usr/include/python2.4

For the third one however
ld -shared example.o example_wrap.o -o _example.so

It gave me a long list of errors listed at the end of
this email.

The error messages were rather baffling because the C
file that was to be made into a python Module was a
simple gcd function, it doesn't need strlen, or any of
the other C functions, and much less Tcl_Append, what
does this have to do with Tcl?

Any help or suggestions on this would be
appreciated...

-Jerry



example_wrap.o:example_wrap.c:(.text+0x1cb3):
undefined reference to `strlen'
example_wrap.o:example_wrap.c:(.text+0x1ccf):
undefined reference to `strchr'
example_wrap.o:example_wrap.c:(.text+0x1cf7):
undefined reference to `strstr'
example_wrap.o:example_wrap.c:(.text+0x1d5d):
undefined reference to `Tcl_Append
Element'
example_wrap.o:example_wrap.c:(.text+0x1e09):
undefined reference to `Tcl_SetRes
ult'
example_wrap.o:example_wrap.c:(.text+0x1e40):
undefined reference to `Tcl_GetStr
ingFromObj'
example_wrap.o:example_wrap.c:(.text+0x1e56):
undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x1e80):
undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x1ec6):
undefined reference to `Tcl_GetStr
ingFromObj'
example_wrap.o:example_wrap.c:(.text+0x1edc):
undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x1f48):
undefined reference to `Tcl_GetObj
Result'
example_wrap.o:example_wrap.c:(.text+0x1f50):
undefined reference to `Tcl_Duplic
ateObj'
example_wrap.o:example_wrap.c:(.text+0x1f70):
undefined reference to `Tcl_GetStr








Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Installing/Using SWIG for python again

2005-08-06 Thread Jerry He
>From Jerry He:
>For the third one however
>ld -shared example.o example_wrap.o -o
_example.so

>It gave me a long list of errors listed at the end of
>this email.

Ok, I managed to get rid of the weird Tcl_Append, and
strlen error messages, but right now I'm left with
undefined references to what seems like Python-C API
objects. 

Does anyone know how to handle these undefined
references?

example_wrap.o:example_wrap.cxx:(.text+0x2ae0):
undefined reference to `__imp___
Py_NoneStruct'
example_wrap.o:example_wrap.cxx:(.text+0x2b97):
undefined reference to `_PyDict_
SetItemString'
example_wrap.o:example_wrap.cxx:(.text+0x2df0):
undefined reference to `_Py_Init
Module4'
example_wrap.o:example_wrap.cxx:(.text+0x2e06):
undefined reference to `_PyCObje
ct_FromVoidPtr'
example_wrap.o:example_wrap.cxx:(.text+0x2e2f):
undefined reference to `_PyModul
e_AddObject'
example_wrap.o:example_wrap.cxx:(.text+0x2ece):
undefined reference to `_Py_Init
Module4'
example_wrap.o:example_wrap.cxx:(.text+0x2edc):
undefined reference to `_PyModul
e_GetDict'
example_wrap.o:example_wrap.cxx:(.text+0x3054):
undefined reference to `__imp__P
yExc_TypeError'
example_wrap.o:example_wrap.cxx:(.text+0x305e):
undefined reference to `_PyErr_F
ormat'
example_wrap.o:example_wrap.cxx:(.text+0x306d):
undefined reference to `__imp__P
yExc_TypeError'
example_wrap.o:example_wrap.cxx:(.text+0x3077):
undefined reference to `_PyErr_F
ormat'
collect2: ld returned 1 exit status

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


SWIG again

2005-08-06 Thread Jerry He
Robert Kern
>Write a distutils setup.py script to do all of the
>compiling and linking.

Ok, I wrote the following distutils setup.py script
from distutils.core import setup, Extension

setup (name = 'example',
  version = '2.4',
  ext_modules = [Extension('example', \ ['example.c',
'example_wrap.c'])] )


I put it in the same directory as the extension files
and I ran from the command line

python setup.py install,

and nothing happened...

Someone help me!!

-Jerry






Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
-- 
http://mail.python.org/mailman/listinfo/python-list


re:SWIG again

2005-08-06 Thread Jerry He
> Robert Kern
>Please don't make a new thread every time you post.

sorry, I chose the digest mode when I signed up, and I
have no idea how to reply, nor any idea how to change
to the normal mode where I get individual emails so I
can actually just hit the reply button instead of
copying your name and part of your message every time
I post... If you know how, please let me know. 

On the other hand, I discovered that had the command
prompt, cmd.exe was trying to use the my cygwin python
executable instead of the Windows python executable. 

Since I didn't have the patience to wait for .NET
Framework SDK to download, (why does python need .NET
framework SDK anyway??).  I tried building it on
cygwin, ... And it WORKED!!!

I was really exited that I can do 
import example
example.gcd(5, 10)

and get the right answer...

However, then I realized I just installed a completely
useless module. 

Can you tell me how to completely remove that module? 

thanks in advance, 

-Jerry
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SWIG again

2005-08-07 Thread Jerry He
 > Can you tell me how to completely remove that
> module? 
> 
> For cygwin, it should be in whatever corresponds to 
> /usr/lib/python2.4/site-packages .
> 
> -- 
> Robert Kern
> [EMAIL PROTECTED]
> 
Hi,
Do you mean to say that all I have to do is delete
"example.py" and the "build" folder? 

(note: I didn't do "python setup install", I did
"python setup build", so all I have is the above two
things in the sourcefile folder. )

--
Jerry




Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Is there a way of executing a command in a string?

2005-08-09 Thread Jerry He
Hi, 
  suppose I have the following string

cmdstr = "b = lambda s: s*s"

  Is there a way to execute this string other than
copying it onto a file and then importing it? 

thanks in advance, 

Jerry

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


distutils on Win32 using .NET Framework SDK

2005-08-14 Thread Jerry He
Hi, 
  I was trying to build a C++ extension on Win32 with
distutils. The extension worked on Cygwin but when I
tried it with the Win32-build python, it complained
that I don't have .NET Framework SDK installed. But
after I installed .NET Framework SDK 2.0, it still
complains
"error: The .NET Framework SDK needs to be installed
before building extensions for Python." (I also did
try restarting my computer)

Does anyone know how to make the .NET Framework SDK
visible to Python?  

thanks in advance, 

-Jerry

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list