Giter Site home page Giter Site logo

unity-python's Introduction

exodrifter

exodrifter.space source code

unity-python's People

Contributors

exodrifter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity-python's Issues

An error happened when I used 'xlrd' to read excel file

I'm sorry to disturb you again and thank you first. There are codes that I wrote to read the excel file:

var engine = global::UnityPython.CreateEngine(); 
var scope = engine.CreateScope();
var paths = engine.GetSearchPaths();
paths.Add(UnityEngine.Application.dataPath + "/UsePythonInUnity/Lib");
engine.SetSearchPaths(paths);
string code = "";
code += "import xlrd" + "\n";
code += "file = 'test.xlsx'" + "\n";
code += "file = file.decode('utf-8')" + "\n";
code += "filename = str(file)" + "\n";
code += "excelfile = xlrd.open_workbook(filename)" + "\n";
code += "sheet1 = excelfile.sheet_by_index(1)" + "\n";
code += "row = sheet1.row_values(1)" + "\n";
code += "line = ''.join('%s' %id for id in row)" + "\n";
var source = engine.CreateScriptSourceFromString(code);
string result = scope.GetVariable<string>("line");

The error info:
Microsoft.Scripting.ArgumentTypeException: expected str, got bytes

2e5fa5b37a5790d6568218bf2cc1b99

I tried to cut down my python codes line by line, and I found the same error happened even if I just used first five lines python codes. But if I just used first four lines python codes, no error would happen. Since I thought the error happened in fifth line python code:
code += "excelfile = xlrd.open_workbook(filename)" + "\n";

But I have checked the type of the variable 'filename' by using 'type()' function, so I can confirm that the type of variable 'filename' is 'str'. Consequently, this error confusing me a lot and I have no idea about the cause of this error. I wuold appreciate it if you can provide some clues. Thanks again!

Make the integration work "out of the box"

Right now, the Python standard library is not included in the build. The reason for this is because the IronPython library only exposes a method for loading python libraries from the disk (as far as I know). We can accomplish this by putting the Python library in the StreamingAssets folder, but this is a security problem since the library can be trivially edited by any user to do whatever they might want. This is the main reason for why the included python library in unity-python doesn't work in builds right out of the box.

Several issues are affected by this problem:

  • The additional steps are not very clear and make the library difficult to use since it doesn't work "out of the box" #10
  • It's not clear how to add additional libraries to the project #4, #8
  • Adding additional libraries might require the addition of more .NET DLLs to the project in order for the build to work #11

I did find an approach that looks appealing recently... It might be possible to compile the Python libraries into DLLs.

If this works the way I think it does, then I can make an interface for installing Python libraries which fetches the package from pip, compiles it into a DLL, and then adds it to your project. This would fix all of the aforementioned issues.

However, it would be best to keep in mind that Python 2 is being deprecated on January 1st, 2020 with pip to follow suit shortly after. I have never tested the library as it stands today with Python 3 (and I don't have any reason to believe it will work). So, perhaps this work will have to wait until the library is ported to work with Python 3.

using cv2 module occured "SyntaxErrorException: unexpected indent" Error.

Hi,Thank you for this project.
Here is the issue:
I want to use opencv - python to do a little test in unity (to read a texture pixel debug),And I refer to the issue which you answered.

I move the "..Python/Lib/site-packages/cv2" file to my "Assets/Python/lib" Unity Folder.And the picture "is.png" is also under the "Assets/Python/lib" folder too. So I run my code which is worked good on PC python environment. And I got this :"SyntaxErrorException: unexpected indent".

So now I can't to deal with it. So much appreciate if you can help. 👍

can't run a python script and catch the output

I tried to run it and I get no output. There is no documentation about how to retrieve the output of a python script.

Once you execute the script with source.Execute(scope);, how do you get the output?

The type initializer for 'CodecsInfo' threw an exception on Build

I runned ironpython succesfully on editor runtime. I built succesfully MACOSX from iMac and when I run the game, I got the error in title.

HelloWorld works but my code doesn't work. My code works on Editor mode but not in build runtime :)

I have tried to change API Compatibility Level.
I have installed from unitypackage.

The error comes in this line :
source.Execute(scope);

My Code :

using UnityEngine;
using IronPython.Hosting;
using UnityEngine.UI;
using System;
using System.IO;
using System.Text;

namespace Exodrifter.UnityPython.Examples
{
    public class PythonLibrary : MonoBehaviour
    {
        public TextAsset einsteinPy;
        public InputField inputField;
        void Start()
        {
            try
            {
                var engine = Python.CreateEngine();
                var scope = engine.CreateScope();
                // Add the python library path to the engine. Note that this will
                // not work for builds; you will need to manually place the python
                // library files in a place that your code can find it at runtime.
                var paths = engine.GetSearchPaths();
                paths.Add(Application.streamingAssetsPath + "/PythonLibs");
                engine.SetSearchPaths(paths);

                string code = @"from constraint import *
problem = Problem()
nationality = ['Danish', 'Spanish', 'Greek']
criteria = nationality
problem.addVariables(criteria,[1, 2, 3])
problem.addConstraint(AllDifferentConstraint(), nationality)
problem.addConstraint(NotInSetConstraint([1]), ['Greek'])
problem.addConstraint(NotInSetConstraint([2]), ['Danish'])
problem.addConstraint(NotInSetConstraint([3]), ['Spanish'])
problem.addConstraint(NotInSetConstraint([3]), ['Danish'])
solution = problem.getSolutions()[0]
result = ''
print len(problem.getSolutions())
for i in range(1,4):
    for x in solution:
        if solution[x] == i:
            result+=str(x) + ' :: ' + str(i) + ' | '";
                var source = engine.CreateScriptSourceFromString(code);
                source.Execute(scope);
                inputField.text += scope.GetVariable<string>("result");
            }
            catch (Exception ex)
            {
                inputField.text += ex.Message + "\r\n" + ex.StackTrace;
            }


        }
    }
}

StackTrace :

The type initializer for 'CodecsInfo' threw an exception.
  at IronPython.Compiler.Tokenizer.TryGetEncoding (System.Text.Encoding defaultEncoding, System.String line, System.Text.Encoding& enc, System.String& encName) [0x000ea] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.GetSourceReader (System.IO.Stream stream, System.Text.Encoding defaultEncoding, System.String path) [0x000e2] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at Microsoft.Scripting.Runtime.LanguageBoundTextContentProvider.GetReader () [0x0002e] in <d47a77cf2c774bcda41abf48422a59f6>:0 
  at Microsoft.Scripting.SourceUnit.GetReader () [0x00000] in <d47a77cf2c774bcda41abf48422a59f6>:0 
  at IronPython.Compiler.Parser.CreateParserWorker (Microsoft.Scripting.Runtime.CompilerContext context, IronPython.PythonOptions options, System.Boolean verbatim) [0x00037] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Compiler.Parser.CreateParser (Microsoft.Scripting.Runtime.CompilerContext context, IronPython.PythonOptions options) [0x00000] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.ParseAndBindAst (Microsoft.Scripting.Runtime.CompilerContext context) [0x0000d] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.CompilePythonCode (Microsoft.Scripting.SourceUnit sourceUnit, Microsoft.Scripting.CompilerOptions options, Microsoft.Scripting.ErrorSink errorSink) [0x00026] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.GetScriptCode (Microsoft.Scripting.SourceUnit sourceCode, System.String moduleName, IronPython.Runtime.ModuleOptions options, IronPython.Compiler.CompilationMode mode) [0x0002d] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.GetScriptCode (Microsoft.Scripting.SourceUnit sourceCode, System.String moduleName, IronPython.Runtime.ModuleOptions options) [0x00000] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) [0x00021] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options) [0x00000] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) [0x00006] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) [0x00040] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) [0x00032] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5[T1,T2,T3,T4,TResult] defaultLoader) [0x0007a] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) [0x00000] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext context, System.Object globals, System.String modName, System.Boolean bottom, System.Int32 level) [0x0010c] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext context, System.String name, System.Object globals, System.Object locals, System.Object fromlist, System.Int32 level) [0x0003c] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at (wrapper delegate-invoke) System.Func`7[IronPython.Runtime.CodeContext,System.String,System.Object,System.Object,System.Object,System.Int32,System.Object].invoke_TResult_T1_T2_T3_T4_T5_T6(IronPython.Runtime.CodeContext,string,object,object,object,int)
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`7[T0,T1,T2,T3,T4,T5,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <344681103b454854bf549f493ce00237>:0 
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <344681103b454854bf549f493ce00237>:0 
  at Microsoft.Scripting.Interpreter.LightLambda.Run8[T0,T1,T2,T3,T4,T5,T6,T7,TRet] (T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) [0x000b1] in <344681103b454854bf549f493ce00237>:0 
  at IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext context, System.String fullName, IronPython.Runtime.PythonTuple from, System.Int32 level) [0x00056] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Operations.PythonOps.ImportWithNames (IronPython.Runtime.CodeContext context, System.String fullName, System.String[] names, System.Int32 level) [0x00008] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`5[T0,T1,T2,T3,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <344681103b454854bf549f493ce00237>:0 
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <344681103b454854bf549f493ce00237>:0 
  at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) [0x0003e] in <344681103b454854bf549f493ce00237>:0 
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) [0x0006a] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.InitializeModule (System.String fileName, IronPython.Runtime.ModuleContext moduleContext, Microsoft.Scripting.ScriptCode scriptCode, IronPython.Runtime.ModuleOptions options) [0x00087] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) [0x0004f] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options) [0x00000] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) [0x00006] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) [0x00040] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.LoadPackageFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) [0x00095] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) [0x00018] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5[T1,T2,T3,T4,TResult] defaultLoader) [0x0007a] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) [0x00000] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext context, System.String name) [0x00069] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext context, System.Object globals, System.String modName, System.Boolean bottom, System.Int32 level) [0x001da] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext context, System.String name, System.Object globals, System.Object locals, System.Object fromlist, System.Int32 level) [0x0003c] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at (wrapper delegate-invoke) System.Func`7[IronPython.Runtime.CodeContext,System.String,System.Object,System.Object,System.Object,System.Int32,System.Object].invoke_TResult_T1_T2_T3_T4_T5_T6(IronPython.Runtime.CodeContext,string,object,object,object,int)
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`7[T0,T1,T2,T3,T4,T5,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <344681103b454854bf549f493ce00237>:0 
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <344681103b454854bf549f493ce00237>:0 
  at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet] (T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) [0x000a0] in <344681103b454854bf549f493ce00237>:0 
  at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) [0x00144] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 
  at (wrapper delegate-invoke) System.Func`8[System.Runtime.CompilerServices.CallSite,IronPython.Runtime.CodeContext,System.Object,System.String,IronPython.Runtime.PythonDictionary,IronPython.Runtime.PythonDictionary,IronPython.Runtime.PythonTuple,System.Object].invoke_TResult_T1_T2_T3_T4_T5_T6_T7(System.Runtime.CompilerServices.CallSite,IronPython.Runtime.CodeContext,object,string,IronPython.Runtime.PythonDictionary,IronPython.Runtime.PythonDictionary,IronPython.Runtime.PythonTuple)
  at IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext context, System.String fullName, IronPython.Runtime.PythonTuple from, System.Int32 level) [0x0002d] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Importer.Import (IronPython.Runtime.CodeContext context, System.String fullName, IronPython.Runtime.PythonTuple from, System.Int32 level) [0x00000] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Runtime.Operations.PythonOps.ImportStar (IronPython.Runtime.CodeContext context, System.String fullName, System.Int32 level) [0x00015] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at Microsoft.Scripting.Interpreter.ActionCallInstruction`3[T0,T1,T2].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <344681103b454854bf549f493ce00237>:0 
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <344681103b454854bf549f493ce00237>:0 
  at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet] (T0 arg0, T1 arg1) [0x0004d] in <344681103b454854bf549f493ce00237>:0 
  at IronPython.Compiler.PythonScriptCode.RunWorker (IronPython.Runtime.CodeContext ctx) [0x0001b] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Compiler.PythonScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00023] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) [0x000c6] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <6e95101e82ea4feb8f6d4cc1271fa904>:0 
  at Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope, Microsoft.Scripting.ErrorSink errorSink) [0x0001e] in <d47a77cf2c774bcda41abf48422a59f6>:0 
  at Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <d47a77cf2c774bcda41abf48422a59f6>:0 
  at Microsoft.Scripting.Hosting.ScriptSource.Execute (Microsoft.Scripting.Hosting.ScriptScope scope) [0x00017] in <d47a77cf2c774bcda41abf48422a59f6>:0 
  at (wrapper remoting-invoke-with-check) Microsoft.Scripting.Hosting.ScriptSource.Execute(Microsoft.Scripting.Hosting.ScriptScope)
  at Exodrifter.UnityPython.Examples.PythonLibrary.Start () [0x0003f] in <ce76bbd974a1440e9790fb7ad4399d31>:0

Update IronPython?

I seen IronPython 3 supports NET 4.5 while IronPython 2 still supports NET 2.0, I think the latest version is 2.7.7 or 2.7.8?

UnauthorisedAccessException in Android

Thank you for sharing this package. it works well on editor, but when i built it for android and run application in android device it gives.
"UnauthorisedAccessException: Access to path "/" is denied."

it is strange because file is present at this path and i can read the file via readalltext. but it gives me error when i pass the same file path to "ExecuteFile()"

Thanks

MissingMemberException: 'module' object has no attribute '_getframe'

When trying to import a python module 'requests'
I'm getting an error:
MissingMemberException: 'module' object has no attribute '_getframe'
IronPython.Runtime.Operations.PythonOps.ObjectGetAttribute (IronPython.Runtime.CodeContext context, System.Object o, System.String name) (at C:/Users/dpek/Desktop/ironpython2/Languages/IronPython/IronPython/Runtime/Operations/PythonOps.cs:1135)
IronPython.Runtime.Operations.ObjectOps.getattribute (IronPython.Runtime.CodeContext context, System.Object self, System.String name) (at C:/Users/dpek/Desktop/ironpython2/Languages/IronPython/IronPython/Runtime/Operations/ObjectOps.cs:74)
IronPython.Runtime.PythonModule.getattribute (IronPython.Runtime.CodeContext context, System.String name) (at C:/Users/dpek/Desktop/ironpython2/Languages/IronPython/IronPython/Runtime/PythonModule.cs:120)
IronPython.Runtime.Binding.PythonGetMemberBinder+PythonModuleDelegate.Target (System.Runtime.CompilerServices.CallSite site, System.Object self, IronPython.Runtime.CodeContext context) (at C:/Users/dpek/Desktop/ironpython2/Languages/IronPython/IronPython/Runtime/Binding/PythonGetMemberBinder.cs:476)
System.Dynamic.UpdateDelegates.UpdateAndExecute2[Object,CodeContext,Object] (System.Runtime.CompilerServices.CallSite site, System.Object arg0, IronPython.Runtime.CodeContext arg1) (at C:/Users/dpek/Desktop/ironpython2/Runtime/Microsoft.Scripting.Core/Actions/UpdateDelegates.Generated.cs:387)
IronPython.Compiler.Ast.DynamicGetMemberExpression+GetMemberInstruction.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at C:/Users/dpek/Desktop/ironpython2/Languages/IronPython/IronPython/Compiler/Ast/DynamicGetMemberExpression.cs:119)
Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at C:/Users/dpek/Desktop/ironpython2/Runtime/Microsoft.Dynamic/Interpreter/Interpreter.cs:126)

After searching for solution in IronPython, there's a common answer that the option has to be enabled:
var options = new Dictionary<string, object>(); options["Frames"] = true; var engine = Python.CreateEngine(options);
But! With: global::UnityPython.CreateEngine(); > CreateEngine cannot get options argument.
Apparently this is fixed in IronPython 2.7.8 - Frames are enabled by default...

Any quick fix?

PlatformNotSupportedException at runtime

paths.Add(Application.streamingAssetsPath + "/Lib");
with the python lib moved to:
Assets\StreamingAssets\Lib
Unity2019.4, .net backend.

PlatformNotSupportedException: Operation is not supported on this platform.
at System.Reflection.Emit.DynamicMethod..ctor (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner, System.Boolean skipVisibility) [0x00006] in <1a63397e003c468ca748f87c92b15e72>:0
at Microsoft.Scripting.Interpreter.LightLambda.MakeRunDelegateCtor (System.Type delegateType) [0x001f4] in :0
at Microsoft.Scripting.Interpreter.LightLambda.GetRunDelegateCtor (System.Type delegateType) [0x00023] in :0
at Microsoft.Scripting.Interpreter.LightLambda.MakeDelegate (System.Type delegateType) [0x00000] in :0
at Microsoft.Scripting.Interpreter.LightDelegateCreator.CreateDelegate (System.Runtime.CompilerServices.StrongBox1[System.Object][] closure) [0x00047] in <adbce494b74f4c8787535955fc342591>:0 at Microsoft.Scripting.Interpreter.LightDelegateCreator.CreateDelegate () [0x00000] in <adbce494b74f4c8787535955fc342591>:0 at Microsoft.Scripting.Ast.LightExpression1[T].Compile (System.Int32 compilationThreshold) [0x0000c] in :0
at IronPython.Compiler.PythonScriptCode.CompileBody (Microsoft.Scripting.Ast.LightExpression`1[T] lambda) [0x00057] in <264a665625104e3c9b8ba1905cf1b515>:0
at IronPython.Compiler.PythonScriptCode.EnsureTarget (System.Boolean register) [0x00015] in <264a665625104e3c9b8ba1905cf1b515>:0
at IronPython.Compiler.PythonScriptCode.GetTarget (System.Boolean register) [0x00021] in <264a665625104e3c9b8ba1905cf1b515>:0
at IronPython.Compiler.PythonScriptCode.RunWorker (IronPython.Runtime.CodeContext ctx) [0x00000] in <264a665625104e3c9b8ba1905cf1b515>:0
at IronPython.Compiler.PythonScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00023] in <264a665625104e3c9b8ba1905cf1b515>:0
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) [0x000c6] in <264a665625104e3c9b8ba1905cf1b515>:0
at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <264a665625104e3c9b8ba1905cf1b515>:0
at Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope, Microsoft.Scripting.ErrorSink errorSink) [0x00026] in <96bae61c64314af5927380c0b6bd16cf>:0
at Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <96bae61c64314af5927380c0b6bd16cf>:0
at Microsoft.Scripting.Hosting.ScriptSource.Execute (Microsoft.Scripting.Hosting.ScriptScope scope) [0x00017] in <96bae61c64314af5927380c0b6bd16cf>:0
at Exodrifter.UnityPython.Examples.PythonLibrary.Start () [0x00038] in E:\Study\UnityPython\Assets\Examples\PythonLibrary.cs:26

System.NotSupportedException: Encoding 37 data could not be found. (Error on Build)

This plugin works just fine in the editor, but I get a werid error on the build. The way I'm starting the script goes something like this:

var engine = UnityPython.CreateEngine();
var paths = engine.GetSearchPaths();
// I've copeid the Python folder to StreamingAssets for the libraries to work
paths.Add(Application.streamingAssetsPath + "/Python/Lib");
engine.SetSearchPaths(paths);

try
{
    var source = engine.CreateScriptSourceFromFile(scriptPath);
    source.Compile();
    // script here is a dynamic variable
    script = engine.Runtime.UseFile(scriptPath); // this is where it stops working
    script.GameManager = this;
    script.start();
}
catch (Exception e)
{
    Debug.Log("Error: " + e);
}

The python script I am using uses the threading and Queue libraries, if that helps.

Full Error:

 System.TypeInitializationException: The type initializer for 'CodecsInfo' threw an exception. ---> System.NotSupportedException: Encoding 37 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
   at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0023f] in <df7127ba07dc446d9f5831a0ec7b1d63>:0 
   at System.Text.EncodingInfo.GetEncoding () [0x00000] in <df7127ba07dc446d9f5831a0ec7b1d63>:0 
   at IronPython.Runtime.Operations.StringOps+CodecsInfo.MakeCodecsDict () [0x004d1] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Operations.StringOps+CodecsInfo..cctor () [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
    --- End of inner exception stack trace ---
   at IronPython.Compiler.Tokenizer.TryGetEncoding (System.Text.Encoding defaultEncoding, System.String line, System.Text.Encoding& enc, System.String& encName) [0x000ea] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.GetSourceReader (System.IO.Stream stream, System.Text.Encoding defaultEncoding, System.String path) [0x000b8] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at Microsoft.Scripting.Runtime.LanguageBoundTextContentProvider.GetReader () [0x0002e] in <b4854a677cbc408eadacd3725c486fb1>:0 
   at Microsoft.Scripting.SourceUnit.GetReader () [0x00000] in <b4854a677cbc408eadacd3725c486fb1>:0 
   at IronPython.Compiler.Parser.CreateParserWorker (Microsoft.Scripting.Runtime.CompilerContext context, IronPython.PythonOptions options, System.Boolean verbatim) [0x00037] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Compiler.Parser.CreateParser (Microsoft.Scripting.Runtime.CompilerContext context, IronPython.PythonOptions options) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.ParseAndBindAst (Microsoft.Scripting.Runtime.CompilerContext context) [0x0000d] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.CompilePythonCode (Microsoft.Scripting.SourceUnit sourceUnit, Microsoft.Scripting.CompilerOptions options, Microsoft.Scripting.ErrorSink errorSink) [0x00026] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.GetScriptCode (Microsoft.Scripting.SourceUnit sourceCode, System.String moduleName, IronPython.Runtime.ModuleOptions options, IronPython.Compiler.CompilationMode mode) [0x0002d] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.GetScriptCode (Microsoft.Scripting.SourceUnit sourceCode, System.String moduleName, IronPython.Runtime.ModuleOptions options) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) [0x00021] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) [0x00006] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) [0x00040] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) [0x00032] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5[T1,T2,T3,T4,TResult] defaultLoader) [0x0007a] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext context, System.String name) [0x00069] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext context, System.Object globals, System.String modName, System.Boolean bottom, System.Int32 level) [0x001da] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext context, System.String name, System.Object globals, System.Object locals, System.Object fromlist, System.Int32 level) [0x0003c] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at (wrapper delegate-invoke) System.Func`7[IronPython.Runtime.CodeContext,System.String,System.Object,System.Object,System.Object,System.Int32,System.Object].invoke_TResult_T1_T2_T3_T4_T5_T6(IronPython.Runtime.CodeContext,string,object,object,object,int)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`7[T0,T1,T2,T3,T4,T5,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet] (T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) [0x000a0] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext context, System.String fullName, IronPython.Runtime.PythonTuple from, System.Int32 level) [0x0002d] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Operations.PythonOps.ImportBottom (IronPython.Runtime.CodeContext context, System.String fullName, System.Int32 level) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`4[T0,T1,T2,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) [0x0003e] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) [0x0006a] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.InitializeModule (System.String fileName, IronPython.Runtime.ModuleContext moduleContext, Microsoft.Scripting.ScriptCode scriptCode, IronPython.Runtime.ModuleOptions options) [0x00087] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) [0x0004f] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) [0x00006] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) [0x00040] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) [0x00032] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5[T1,T2,T3,T4,TResult] defaultLoader) [0x0007a] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext context, System.String name) [0x00069] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext context, System.Object globals, System.String modName, System.Boolean bottom, System.Int32 level) [0x001da] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext context, System.String name, System.Object globals, System.Object locals, System.Object fromlist, System.Int32 level) [0x0003c] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at (wrapper delegate-invoke) System.Func`7[IronPython.Runtime.CodeContext,System.String,System.Object,System.Object,System.Object,System.Int32,System.Object].invoke_TResult_T1_T2_T3_T4_T5_T6(IronPython.Runtime.CodeContext,string,object,object,object,int)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`7[T0,T1,T2,T3,T4,T5,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet] (T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) [0x000a0] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext context, System.String fullName, IronPython.Runtime.PythonTuple from, System.Int32 level) [0x0002d] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Operations.PythonOps.ImportWithNames (IronPython.Runtime.CodeContext context, System.String fullName, System.String[] names, System.Int32 level) [0x0000a] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`5[T0,T1,T2,T3,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) [0x0003e] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) [0x0006a] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.InitializeModule (System.String fileName, IronPython.Runtime.ModuleContext moduleContext, Microsoft.Scripting.ScriptCode scriptCode, IronPython.Runtime.ModuleOptions options) [0x00087] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) [0x0004f] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) [0x00006] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) [0x00040] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) [0x00032] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5[T1,T2,T3,T4,TResult] defaultLoader) [0x0007a] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext context, System.String name) [0x00069] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext context, System.Object globals, System.String modName, System.Boolean bottom, System.Int32 level) [0x001da] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext context, System.String name, System.Object globals, System.Object locals, System.Object fromlist, System.Int32 level) [0x0003c] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at (wrapper delegate-invoke) System.Func`7[IronPython.Runtime.CodeContext,System.String,System.Object,System.Object,System.Object,System.Int32,System.Object].invoke_TResult_T1_T2_T3_T4_T5_T6(IronPython.Runtime.CodeContext,string,object,object,object,int)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`7[T0,T1,T2,T3,T4,T5,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet] (T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) [0x000a0] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext context, System.String fullName, IronPython.Runtime.PythonTuple from, System.Int32 level) [0x0002d] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Runtime.Operations.PythonOps.ImportTop (IronPython.Runtime.CodeContext context, System.String fullName, System.Int32 level) [0x00000] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`4[T0,T1,T2,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0004f] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet] (T0 arg0, T1 arg1) [0x0004d] in <bdde1939ff4d4d6b828ba549cdd24694>:0 
   at IronPython.Compiler.PythonScriptCode.RunWorker (IronPython.Runtime.CodeContext ctx) [0x0001b] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Compiler.PythonScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00023] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) [0x000c6] in <0569a20e5dd94f74a766cc11c6214b7c>:0 
   at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <0569a20e5dd94f74a766c<message truncated>

Import Numpy with Latest Build

I read comments from some of the previous issues, and tried to import numpy module.
Version of Unity 2018.4, Windows
Here are steps that I took:

  1. Install Anaconda, & install virtual environment with python 2.7
  2. Install numpy in python 2.7 environment
  3. Find the path of python 2.7 libs and add line paths.Add('path_to_lib\\lib'); in examples/pythonlibrary
  4. Step 3 gave error and I deleted the line added in step 3
  5. I tried copy related folders in libs (all mkl folders & folders with numpy in it) to Python/Libs in the project

Problem encountered:
Both 3 and 4 gives same error:

ImportException: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
  your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
  1. Check that you are using the Python you expect (you're using None),
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy versions you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

     Note: this error has many possible causes, so please don't comment on
     an existing issue about this - open a new one instead.

Original error was: cannot import _multiarray_umath from numpy.core

Microsoft.Scripting.Runtime.LightExceptions.ThrowException (Microsoft.Scripting.Runtime.LightExceptions+LightException lightEx) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow (System.Object value) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.FuncCallInstruction`2[T0,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.HandleException (Microsoft.Scripting.Interpreter.InterpretedFrame frame, System.Exception exception) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.InitializeModule (System.String fileName, IronPython.Runtime.ModuleContext moduleContext, Microsoft.Scripting.ScriptCode scriptCode, IronPython.Runtime.ModuleOptions options) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadPackageFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5[T1,T2,T3,T4,TResult] defaultLoader) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportNestedModule (IronPython.Runtime.CodeContext context, IronPython.Runtime.PythonModule module, System.String[] parts, System.Int32 current, IronPython.Runtime.List path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFrom (IronPython.Runtime.CodeContext context, System.Object from, System.String name) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Operations.PythonOps.ImportFrom (IronPython.Runtime.CodeContext context, System.Object module, System.String name) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
Microsoft.Scripting.Interpreter.FuncCallInstruction`4[T0,T1,T2,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.InitializeModule (System.String fileName, IronPython.Runtime.ModuleContext moduleContext, Microsoft.Scripting.ScriptCode scriptCode, IronPython.Runtime.ModuleOptions options) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, IronPython.Runtime.ModuleOptions options) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadPackageFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5[T1,T2,T3,T4,TResult] defaultLoader) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext context, System.String name) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext context, System.Object globals, System.String modName, System.Boolean bottom, System.Int32 level) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext context, System.String name, System.Object globals, System.Object locals, System.Object fromlist, System.Int32 level) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
Microsoft.Scripting.Interpreter.FuncCallInstruction`7[T0,T1,T2,T3,T4,T5,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet] (T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext context, System.String fullName, IronPython.Runtime.PythonTuple from, System.Int32 level) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Runtime.Operations.PythonOps.ImportTop (IronPython.Runtime.CodeContext context, System.String fullName, System.Int32 level) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
Microsoft.Scripting.Interpreter.FuncCallInstruction`4[T0,T1,T2,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet] (T0 arg0, T1 arg1) (at <bdde1939ff4d4d6b828ba549cdd24694>:0)
IronPython.Compiler.PythonScriptCode.RunWorker (IronPython.Runtime.CodeContext ctx) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.PythonScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) (at <0569a20e5dd94f74a766cc11c6214b7c>:0)
Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope, Microsoft.Scripting.ErrorSink errorSink) (at <b4854a677cbc408eadacd3725c486fb1>:0)
Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope) (at <b4854a677cbc408eadacd3725c486fb1>:0)
Microsoft.Scripting.Hosting.ScriptSource.Execute (Microsoft.Scripting.Hosting.ScriptScope scope) (at <b4854a677cbc408eadacd3725c486fb1>:0)
(wrapper remoting-invoke-with-check) Microsoft.Scripting.Hosting.ScriptSource.Execute(Microsoft.Scripting.Hosting.ScriptScope)
Exodrifter.UnityPython.Examples.PythonLibrary.Start () (at Assets/Python/Examples/PythonLibrary.cs:28)

"The dll is not allowed to be included or could not be found." exception when building project

Hi sir,
Thanks for sharing this awesome library, it works smoothly in the editor!

However, when I tried to build the project (PC standalone in this case), I got this error which I could not understand why. It said "ArgumentException: The Assembly PresentationFramework is referenced by IronPython.Wpf ('Assets/Libs/Python/IronPython.2.7.9/lib/net45/IronPython.Wpf.dll'). But the dll is not allowed to be included or could not be found.", but I have this .dll file in my Assets folder already.

I set the Scripting Runtime Version to ".NET 4.x Equivalent" and Api Compatibility Level to ".NET 4.x".
I also tried to import IronPython from official website but still got the same error. Could you help me with this problem?

capture

socket.send() - expected str, got bytearray

We need a socket.send () method that takes a bytearray as its argument.

Hi, Thanks to Unity Python.

This time, I run a socket communication Python file made with general Python. I create a bytearray and send it. I tried several attempts to convert it to a string, but it all failed.

I've downloaded the IronPython source separately and tried to build it but it will not work with Unity.

Can you help me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.