[Pythonmac-SIG] pythonw and python with applescript

Zhi Peng zhiyong_peng2003 at yahoo.com
Tue Dec 13 19:02:46 CET 2005


Hi! All 

I posted a few items in a few days. I think the first
problem I had is that it can not import python module
when I used "from appscrpt import *" inside modue
because appscript need pythonw instead of python. Here
is the error message: 

========================================================

zhi-pengs-power-mac-g5:~/Documents/projects/c-code/pyToDLL/test1
zpeng$ python
Python 2.3.5 (#1, Mar 20 2005, 20:38:20) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)]
on darwin
Type "help", "copyright", "credits" or "license" for
more information.
>>> import StringModule
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "StringModule.py", line 4, in ?
    from appscript import *
  File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/appscript/__init__.py",
line 14, in ?
    from specifier import app, CommandError
  File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/appscript/specifier.py",
line 9, in ?
    import aem
  File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/aem/__init__.py",
line 25, in ?
    from send import *
  File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/aem/send/__init__.py",
line 105, in ?
    raise RuntimeError, "Can't send Apple events: no
access to Window Manager. (aem-based scripts must be
run within a GUI process; e.g. use 'pythonw', not
'python', if running script in shell)"
RuntimeError: Can't send Apple events: no access to
Window Manager. (aem-based scripts must be run within
a GUI process; e.g. use 'pythonw', not 'python', if
running script in shell)
>>> 

====================================================

Does anyone have any ideal on solving the probelm.
Thanks in advance. 

It seems PyImport_ImportModule also use python instead
of pythonw. 


Regards 

Zhi 



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Pythonmac-SIG mailing list