###前提・実現したいこと
IronPythonでPython標準モジュールのthreadingをimportしたいです。
IronPythonはUnityでアプリ開発をするために導入しました。
###発生している問題・エラーメッセージ
IronPython/Lib以下の他の標準モジュールに関してはimoportできるのですが、threadingだけはimportできず、以下のようなエラーが出てしまいます。
SyntaxErrorException: unexpected token ',' IronPython.Runtime.ThrowingErrorSink.Add (Microsoft.Scripting.SourceUnit sourceUnit, System.String message, SourceSpan span, Int32 errorCode, Severity severity) IronPython.Compiler.Parser.ReportSyntaxError (Int32 start, Int32 end, System.String message, Int32 errorCode) IronPython.Compiler.Parser.ReportSyntaxError (IronPython.Compiler.Token t, IndexSpan span, Int32 errorCode, Boolean allowIncomplete) IronPython.Compiler.Parser.ReportSyntaxError (TokenWithSpan t, Int32 errorCode) IronPython.Compiler.Parser.ReportSyntaxError (TokenWithSpan t) IronPython.Compiler.Parser.ReadName () IronPython.Compiler.Parser.ParseParameterName (System.Collections.Generic.HashSet`1 names, ParameterKind kind) IronPython.Compiler.Parser.ParseVarArgsList (TokenKind terminator) IronPython.Compiler.Parser.ParseFuncDef () IronPython.Compiler.Parser.ParseStmt () IronPython.Compiler.Parser.ParseSuite () IronPython.Compiler.Parser.ParseClassOrFuncBody () IronPython.Compiler.Parser.ParseClassDef () IronPython.Compiler.Parser.ParseStmt () IronPython.Compiler.Parser.ParseFileWorker (Boolean makeModule, Boolean returnValue) IronPython.Compiler.Parser.ParseFile (Boolean makeModule, Boolean returnValue) IronPython.Runtime.PythonContext.ParseAndBindAst (Microsoft.Scripting.Runtime.CompilerContext context) IronPython.Runtime.PythonContext.CompilePythonCode (Microsoft.Scripting.SourceUnit sourceUnit, Microsoft.Scripting.CompilerOptions options, Microsoft.Scripting.ErrorSink errorSink) IronPython.Runtime.PythonContext.GetScriptCode (Microsoft.Scripting.SourceUnit sourceCode, System.String moduleName, ModuleOptions options, IronPython.Compiler.CompilationMode mode) IronPython.Runtime.PythonContext.GetScriptCode (Microsoft.Scripting.SourceUnit sourceCode, System.String moduleName, ModuleOptions options) IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, ModuleOptions options, Microsoft.Scripting.ScriptCode& scriptCode) IronPython.Runtime.PythonContext.CompileModule (System.String fileName, System.String moduleName, Microsoft.Scripting.SourceUnit sourceCode, ModuleOptions options) IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext context, Microsoft.Scripting.SourceUnit sourceCode, System.String name, System.String path) IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext context, System.String name, System.String path) IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, System.String str) IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path, System.Func`5 defaultLoader) IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext context, System.String name, System.String fullName, IronPython.Runtime.List path) IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext context, System.String name) IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext context, System.Object globals, System.String modName, Boolean bottom, Int32 level) IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext context, System.String name, System.Object globals, System.Object locals, System.Object fromlist, Int32 level) Microsoft.Scripting.Interpreter.FuncCallInstruction`7[IronPython.Runtime.CodeContext,System.String,System.Object,System.Object,System.Object,System.Int32,System.Object].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame)
###該当のソースコード
Python
1import clr 2clr.AddReferenceByPartialName('UnityEngine') 3import UnityEngine 4 5import sys 6sys.path.append(UnityEngine.Application.dataPath + '/../../IronPython/Lib') 7 8import threading 9print(threading.__file__)
###試したこと
他の物をimportしてみたところ(numbersをimportしてみました)、こちらは正しく読み込まれたらしく、
C:\Users......\IronPython\Lib\numbers.py
と出力されました。
###補足情報(言語/FW/ツール等のバージョンなど)
Python3.5を使っています
回答1件
あなたの回答
tips
プレビュー