import problem

Asked by Jeff_Vallis on 2020-05-26

2.0.4-2020-03-14_08:01/Mac10.15.4/Java13(64)13.0.1+9

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/Generator_Run.py', but no encoding declared; see http://www.python.org/peps/pep-0263.html 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 = "£"
etc.......

Generator_Run :-
from sikuli import *

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

x = "£"
etc.......

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

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-05-26
Last reply:
2020-05-26
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.