import problem

Asked by Jeff_Vallis on 2020-05-26


I seem to be having problem with import of sub module

if I have a main with
x = "£"
both load ok
if I have the same in sub module
I get
[error] script [ Generator ] stopped with error in line 2
[error] SyntaxError ( !!WHILE IMPORTING!! Non-ASCII character in file '/Users/Jeff/Documents/Sikuli_Live/SikuliScripts/Generator/Code/Generator_Run.sikuli/', but no encoding declared; see for details )
[error] --- Traceback --- error source first
line: module ( function ) statement
2: main ( <module> ) import Generator_Run

Main :-

import Generator_Global
import Generator_Run
import Generator_Selects
import datetime
import time
import os

x = "£"

Generator_Run :-
from sikuli import *

import Generator_Global
import datetime
import time
import os
import re
import os.path
from os import path

x = "£"

Put this at the start of both scripts to find out why I was having a problem with replacing "£" in the imported script when it was ok in the main script.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

if used in subs, add this line as first line to the script:

# -*- coding: utf-8 -*-

(this is automatically added at runtime to a main script by the Jython support of SikuliX)

Can you help with this problem?

Provide an answer of your own, or ask Jeff_Vallis for more information if necessary.

To post a message you must log in.