[Pythonmac-SIG] Re: PythonScript - Questions -v0.5 beta 1 24/04/98

Bill Bedford billb@mousa.demon.co.uk
Tue, 24 Aug 1999 12:01:24 +0100


At 9:05 pm +0200 23/08/99, L. Humbert wrote:

>---
>Our Server is a Linux-based system - so I went the way up to Python 
>by studying
>BSCW, which we will set up for using in school to -
>after some time I used some rudimentary Python-based functions to program some
>(more or less) useful things for the mac-linux-connection (you may 
>look at them
>at
>http://in.Hagen.de/humbert/vortraege/
>but ... excuse my ... itīs in german)
>------
>
>The problems and thought of solutions:
>================================
>Our iMacs in school are running MacOS 8.6.
>
>We want to lock them with ResEdit (make some folders:
>unvisible
>some
>unvisible and locked
>etc.

Neither of these are available through apple events.  They can be 
done through the file manager.

>
>We have to use some  local software on our iMacs.
>
>In getaete.py I found, that you have only implemented
>English, French and Japanese,
>but not German -- please tell me the nessecary Code for german -- perhaps
>it is "3"?
>What do we have  to change, to make this work?

These codes refer to the applescript dialects. As far as I know Apple 
has never released (written?, finished?) a German dialect. At the 
moment it seems only the English one is supported, so you are 
unlikely to find one of the others.

>Why did you comment out the
>openosax ?
>and
>openaete ?
>in getaete.py

These two methods read though all the applescript information in the 
dialect and the scripting additions. If you are only addressing a 
single application then commenting them out will speed up your script 
a lot.

>
>We want to Python-Script some things, we can do with AppleScript, 
>but some other
>(like writing on the Server; checking, if the user has correct locked in, ..)
>are only possible with Python, I think.

You may find that the standard python/apple event interface will work 
better for you. The apple event information is in text files which 
would work on your server. Using PythonScript  would means reading 
resources off one of the clients at every transaction.

>
>PPS: The test of the application PyScript.py didnīt run:
>
>>>> import PythonScript
>>>> SIGNATURE = 'MACS'
>>>> TIMEOUT = 10*60*60
>>>> PythonScript.PsScript(SIGNATURE, TIMEOUT)
>
>Traceback (innermost last):
>  File "<stdin>", line 1, in ?
>  File "brecht:Programmiersprachen:Python 
>1.5.2b1:Mac:Contrib:PythonScript:PythonScript.py", line 116, in 
>PsScript
>    pyscript = getaete.Getaete(sig)
>  File "brecht:Programmiersprachen:Python 
>1.5.2b1:Mac:Contrib:PythonScript:getaete.py", line 48, in Getaete
>    data = compileaete(data)
>  File "brecht:Programmiersprachen:Python 
>1.5.2b1:Mac:Contrib:PythonScript:getaete.py", line 222, in 
>compileaete
>    gsuites = openaeut()
>  File "brecht:Programmiersprachen:Python 
>1.5.2b1:Mac:Contrib:PythonScript:getaete.py", line 319, in openaeut
>    rf = OpenRFPerm(fullname, 0, 1)
>TypeError: Str255 arg must be string of at most 255 chars

fullname is the  path to  the applescript dialect. On my system it is

"Hermit:System Folder:Scripting Additions:Dialects:English Dialect"

=65 characters If you are getting a Str255 error then either you have 
your system folder buried very deep or Python is looking for the 
dialect file on your server.


I can't help thinking that what you are trying to down would be a lot 
simpler if you used OS X server instead of Linux :-)
-- 
Bill Bedford                                billb@mousa.demon.co.uk

History has to be observed, otherwise its not history, It's just....
well one thing happening after another.