Unexpected token append

  • Thread starter Thread starter P.B.C.G Fernando
  • Start date Start date
P

P.B.C.G Fernando

Guest
I wrote simple application language translator application using IronPython and I call the python code via C# console application, I tested python code separately, it works fine. however when I call the python code via C# application it always gives Microsoft.Scripting.SyntaxErrorException: 'unexpected token 'append'' Error message.

ScriptEngine engine = Python.CreateEngine();
ScriptSource source = engine.CreateScriptSourceFromFile(@"D:\Projects\Translator.py");

ICollection<string> Paths = engine.GetSearchPaths();
Paths.Add(@"C:\Program Files\Python37\Lib\");
Paths.Add(@"
C:\Program Files\Python37\Lib\site-packages\");
engine.
SetSearchPaths(Paths);

ScriptScope scope = engine.CreateScope();
source.
Execute(scope);

dynamic GoogleTranslator = scope.GetVariable("GoogleTranslator");
dynamic gTranslator = GoogleTranslator();
gTranslator.
SetInfo("'Привет, корова мальчик'");
var result = gTranslator.Translate();

Console.Write(result.text);
Console.Read();


Can anyone tell me what is the issue with the code.


Gehan Fernando Snr. Engineer Technology. AKLO Information Technologies (Pvt) Ltd. #58, 42nd Lane, 5th Floor, Wellawatta, Colombo 06, Sri Lanka. Phone: +94 117 520000 | Mobile: +94 772 269625

Continue reading...
 
Back
Top