Page 1 of 1

Zeus 3.97, python macro bug

Posted: Thu Jul 09, 2009 3:14 am
by gwgs
I recorded a macro in zeus 3.97, in this case to display ascii character 218. I use python for my macros in zeus. Code generated below. When I try running it I get the error at the bottom of the script.

If I switch to LUA for macros and re-record the macro it works ok

Code: Select all

import zeus

def key_macro():
    zeus.screen_update_disable()
    zeus.write("Ú") # ASCII(0218)
    zeus.screen_update_enable()
    zeus.screen_update()

key_macro() # run the macro

"""
Python selected as scripting language

ERRORS GIVEN WHEN SCRIPT IS RUN:
Scripting Error :>   File "c:\apt\zeus\zScript\Macro2.py", line 5
Scripting Error :> SyntaxError: Non-ASCII character '\xda' in file c:\apt\zeus\zScript\Macro2.py on line 5, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

Macro script generated '8' Debug, Error and/or Warning message(s).
"""

This occurs in the beta posted in the previous thread (which fixed the problem I was having with high ascii codes in my code).


Thanks in advance,

Grant Smith

Posted: Thu Jul 09, 2009 3:44 am
by jussij
The Zeus 3.97 release uses the later Python 2.6.2 version.
c:\apt\zeus\zScript\Macro2.py on line 5, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

From the Python error message it looks like something has changed in Python itself and I suspect this link in the error might give some more information as to what has change.

The other option would be to take the scriptpy.dll and python24.dll from the previous Zeus version and downgrade the Python scripting module.

Cheers Jussi

Posted: Thu Jul 09, 2009 3:52 am
by jussij
When I run this macro in a new file on my machine I get no errors:

Code: Select all

import zeus

def key_macro():
    zeus.screen_update_disable()
    zeus.write("Ú") # ASCII(0218)
    zeus.screen_update_enable()
    zeus.screen_update()

key_macro() # run the macro
Also when I save this new file as UTF-8 I get the expected Ú UTF-8 character.

So my guess is Python is doing something that is code page specific, which is why the macro runs on my machine but not on yours :?

Cheers Jussi

Python Issues with 3.97

Posted: Thu Jul 09, 2009 3:36 pm
by mgag
I also use Python for macros, and got a new error for the ArchiveAllTabs macro. I had to add another parm to get rid of a cSpawn return error code. See the post in Scripts.

Posted: Fri Jul 10, 2009 1:48 am
by jussij
I have managed to replicate this issue ;)

The problem relates to the fact that when the script is recorded, Zeus creates an a file to hold the script. You can see this file using the Macros, View Source menu.

But if you view the script you will see that Zeus has created an ASCII file (i.e. see the status bar), but this new version of Python seems to be complaining that the ASCII file contains the non ASCII Ú character :?

But if you use the Macros, View Source menu and then save the file as UTF-8 file then Python will happily run the script.

So while I have replicated the issue I really not sure what is the correct way to fix this issue :(

Cheers Jussi