clj-python / libpython-clj

Python bindings for Clojure
Eclipse Public License 2.0
1.06k stars 69 forks source link

Loading python library: null #149

Closed PlumpMath closed 3 years ago

PlumpMath commented 3 years ago

lein run

OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release. Warning: os-file not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic os-file or change the name. (tray/pnix/java.clj:16) Warning: os-file not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic os-file or change the name. (tray/pnix/java.clj:16) 3월 07, 2021 3:58:51 오전 libpython-clj2.python.info invoke 정보: Detecting startup info 3월 07, 2021 3:58:51 오전 libpython-clj2.python invoke 정보: Startup info {:lib-version "3.8", :exec-prefix "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8", :executable "/Applications/Xcode.app/Contents/Developer/usr/bin/python3", :libnames ("python3.8m" "python3.8"), :prefix "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8", :base-prefix "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8", :libname "python3.8m", :base-exec-prefix "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8", :python-home "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8", :version [3 8 2], :platform "darwin"} 3월 07, 2021 3:58:52 오전 libpython-clj2.python invoke 정보: Loading python library: null Syntax error (ClassCastException) compiling at (tray/pnix/python.clj:26:1). class java.lang.String cannot be cast to class clojure.lang.Associative (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.Associative is in unnamed module of loader 'app')

Full report at: /var/folders/lg/vjmm77jj45341m22xzkwl9rw0000gn/T/clojure-10632292058732343759.edn

------------------------- code (ns tray.pnix.python (:require ;; [libpython-clj.require :refer [require-python]]
;; [libpython-clj.python :refer [py. py.. py.-] :as py] ;; [libpython-clj2.require :refer [require-python]]
[libpython-clj2.python :refer [py. py.. py.-] :as py] ;; [tech.v2.datatype :as dtype] [tray.pnix.java :as JAVA]))

(defonce python-loc "/Applications/Xcode.app/Contents/Developer/usr/bin/python3")

(defonce python-lib "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Python3")

(py/initialize! :python-executable python-loc :library-path python-lib)

PlumpMath commented 3 years ago

/var/folders/lg/vjmm77jj45341m22xzkwl9rw0000gn/T/clojure-10632292058732343759.edn --- file log

{:clojure.main/message "Syntax error (ClassCastException) compiling at (tray/pnix/python.clj:26:1).\nclass java.lang.String cannot be cast to class clojure.lang.Associative (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.Associative is in unnamed module of loader 'app')\n", :clojure.main/triage {:clojure.error/phase :compile-syntax-check, :clojure.error/line 26, :clojure.error/column 1, :clojure.error/source "python.clj", :clojure.error/path "tray/pnix/python.clj", :clojure.error/class java.lang.ClassCastException, :clojure.error/cause "class java.lang.String cannot be cast to class clojure.lang.Associative (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.Associative is in unnamed module of loader 'app')"}, :clojure.main/trace {:via [{:type clojure.lang.Compiler$CompilerException, :message "Syntax error compiling at (tray/pnix/python.clj:26:1).", :data {:clojure.error/phase :compile-syntax-check, :clojure.error/line 26, :clojure.error/column 1, :clojure.error/source "tray/pnix/python.clj"}, :at [clojure.lang.Compiler load "Compiler.java" 7652]} {:type java.lang.ClassCastException, :message "class java.lang.String cannot be cast to class clojure.lang.Associative (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.Associative is in unnamed module of loader 'app')", :at [clojure.lang.RT assoc "RT.java" 827]}], :trace [[clojure.lang.RT assoc "RT.java" 827] [clojure.core$assoc5433 invokeStatic "core.clj" 195] [clojure.core$assoc5433 doInvoke "core.clj" 192] [clojure.lang.RestFn invoke "RestFn.java" 494] [libpython_clj2.python$initializeBANG invokeStatic "python.clj" 82] [libpython_clj2.python$initializeBANG doInvoke "python.clj" 42] [clojure.lang.RestFn invoke "RestFn.java" 457] [tray.pnix.python$eval11091 invokeStatic "python.clj" 26] [tray.pnix.python$eval11091 invoke "python.clj" 26] [clojure.lang.Compiler eval "Compiler.java" 7181] [clojure.lang.Compiler load "Compiler.java" 7640] [clojure.lang.RT loadResourceScript "RT.java" 381] [clojure.lang.RT loadResourceScript "RT.java" 372] [clojure.lang.RT load "RT.java" 459] [clojure.lang.RT load "RT.java" 424] [clojure.core$load$fn6856 invoke "core.clj" 6115] [clojure.core$load invokeStatic "core.clj" 6114] [clojure.core$load doInvoke "core.clj" 6098] [clojure.lang.RestFn invoke "RestFn.java" 408] [clojure.core$load_one invokeStatic "core.clj" 5897] [clojure.core$load_one invoke "core.clj" 5892] [clojure.core$load_lib$fn6796 invoke "core.clj" 5937] [clojure.core$load_lib invokeStatic "core.clj" 5936] [clojure.core$load_lib doInvoke "core.clj" 5917] [clojure.lang.RestFn applyTo "RestFn.java" 142] [clojure.core$apply invokeStatic "core.clj" 669] [clojure.core$load_libs invokeStatic "core.clj" 5974] [clojure.core$load_libs doInvoke "core.clj" 5958] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.core$apply invokeStatic "core.clj" 669] [clojure.core$require invokeStatic "core.clj" 5996] [clojure.core$require doInvoke "core.clj" 5996] [clojure.lang.RestFn invoke "RestFn.java" 482] [tray.core$eval157$loading6737auto__158 invoke "core.clj" 3] [tray.core$eval157 invokeStatic "core.clj" 3] [tray.core$eval157 invoke "core.clj" 3] [clojure.lang.Compiler eval "Compiler.java" 7181] [clojure.lang.Compiler eval "Compiler.java" 7170] [clojure.lang.Compiler load "Compiler.java" 7640] [clojure.lang.RT loadResourceScript "RT.java" 381] [clojure.lang.RT loadResourceScript "RT.java" 372] [clojure.lang.RT load "RT.java" 459] [clojure.lang.RT load "RT.java" 424] [clojure.core$load$fn__6856 invoke "core.clj" 6115] [clojure.core$load invokeStatic "core.clj" 6114] [clojure.core$load doInvoke "core.clj" 6098] [clojure.lang.RestFn invoke "RestFn.java" 408] [clojure.core$load_one invokeStatic "core.clj" 5897] [clojure.core$load_one invoke "core.clj" 5892] [clojure.core$load_lib$fn6796 invoke "core.clj" 5937] [clojure.core$load_lib invokeStatic "core.clj" 5936] [clojure.core$load_lib doInvoke "core.clj" 5917] [clojure.lang.RestFn applyTo "RestFn.java" 142] [clojure.core$apply invokeStatic "core.clj" 669] [clojure.core$load_libs invokeStatic "core.clj" 5974] [clojure.core$load_libs doInvoke "core.clj" 5958] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.core$apply invokeStatic "core.clj" 669] [clojure.core$require invokeStatic "core.clj" 5996] [clojure.core$require doInvoke "core.clj" 5996] [clojure.lang.RestFn invoke "RestFn.java" 408] [user$eval140$fn__144 invoke "form-init11923790674006242382.clj" 1] [user$eval140 invokeStatic "form-init11923790674006242382.clj" 1] [user$eval140 invoke "form-init11923790674006242382.clj" 1] [clojure.lang.Compiler eval "Compiler.java" 7181] [clojure.lang.Compiler eval "Compiler.java" 7171] [clojure.lang.Compiler load "Compiler.java" 7640] [clojure.lang.Compiler loadFile "Compiler.java" 7578] [clojure.main$load_script invokeStatic "main.clj" 475] [clojure.main$init_opt invokeStatic "main.clj" 477] [clojure.main$init_opt invoke "main.clj" 477] [clojure.main$initialize invokeStatic "main.clj" 508] [clojure.main$null_opt invokeStatic "main.clj" 542] [clojure.main$null_opt invoke "main.clj" 539] [clojure.main$main invokeStatic "main.clj" 664] [clojure.main$main doInvoke "main.clj" 616] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.main main "main.java" 40]], :cause "class java.lang.String cannot be cast to class clojure.lang.Associative (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.Associative is in unnamed module of loader 'app')", :phase :compile-syntax-check}}

Thanks.

PlumpMath commented 3 years ago

ah found!

(py/initialize! :python-executable python-loc :library-path python-lib) to (py/initialize! {:python-executable python-loc :library-path python-lib})

cnuernber commented 3 years ago

Hmm. Ok, i try to detect that and document it.

cnuernber commented 3 years ago

I have decided to go back to exactly the argument format of the original initialize! call as there is a bit of preexisting code that relies on this. So that should fix your issue with no changes aside from a different namespace require. Sorry for the thrashing!

cnuernber commented 3 years ago

2.00-beta-6 has reverted initialize! call. If you a moment could you test this out?

PlumpMath commented 3 years ago

@cnuernber
Update version and Even if you revert to the old way, It works fine. Thanks.

cnuernber commented 3 years ago

OK, closing :-).