PySide.jl icon indicating copy to clipboard operation
PySide.jl copied to clipboard

Problem with python3 on Debian Wheezy

Open sam81 opened this issue 10 years ago • 5 comments

I'm unable to load PySide when I initialize PyCall with python3 as follows:

julia> using PyCall

julia> pyinitialize("python3")

julia> using PySide
ERROR: PyError (PyEval_EvalCode) <class 'TypeError'>
TypeError('exec() arg 1 must be a string, bytes or code object',)
  File "PyCall.jl", line 1, in <module>

 in pyerr_check at /home/sam/.julia/v0.3/PyCall/src/exception.jl:58
 in pyeval_ at /home/sam/.julia/v0.3/PyCall/src/PyCall.jl:85
 in pyeval at /home/sam/.julia/v0.3/PyCall/src/PyCall.jl:892
 in pyeval at /home/sam/.julia/v0.3/PyCall/src/PyCall.jl:888
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
while loading /home/sam/.julia/v0.3/PySide/src/qtutils.jl, in expression starting on line 27
while loading /home/sam/.julia/v0.3/PySide/src/PySide.jl, in expression starting on line 28

sam81 avatar Jul 03 '14 11:07 sam81

@sam81 Thanks for the report. Can you see if this call works with python 3:

PyCall.pyeval("execfile(x, globals())", x = Pkg.dir("PySide", "tpl", "imports.tpl")) 

For some reason (long forgotten) I added this code to get it to work under python 3

PyCall.pyeval("exec(open(x, 'rb'), globals())", x = Pkg.dir("PySide", "tpl", "imports.tpl"))

but it is now failing as exec wants only 1 argument.

jverzani avatar Jul 08 '14 18:07 jverzani

https://github.com/jverzani/PySide.jl/issues/9

PyCall.pyeval("exec(open(x, 'rb').read(), globals())", x = Pkg.dir("PySide", "tpl", "imports.tpl"))

You forgot the .read()...

oprypin avatar Jul 08 '14 18:07 oprypin

Thanks. Just pushed that change to the master on github.

On Tue, Jul 8, 2014 at 2:28 PM, Oleh Prypin [email protected] wrote:

PyCall.pyeval("exec(open(x, 'rb').read(), globals())", x = Pkg.dir("PySide", "tpl", "imports.tpl"))

You forgot the .read()...

— Reply to this email directly or view it on GitHub https://github.com/jverzani/PySide.jl/issues/10#issuecomment-48380330.

John Verzani Chair, Department of Mathematics College of Staten Island, CUNY [email protected]

jverzani avatar Jul 08 '14 18:07 jverzani

Thanks, I can confirm that the fix pushed on the master branch works.

sam81 avatar Jul 08 '14 19:07 sam81

Thanks again!

On Tue, Jul 8, 2014 at 3:11 PM, Samuele Carcagno [email protected] wrote:

Thanks, I can confirm that the fix pushed on the master branch works.

— Reply to this email directly or view it on GitHub https://github.com/jverzani/PySide.jl/issues/10#issuecomment-48386271.

John Verzani Chair, Department of Mathematics College of Staten Island, CUNY [email protected]

jverzani avatar Jul 08 '14 19:07 jverzani