jverzani / PySide.jl

julia interface for accessing Qt via PyCall and PySide
MIT License
18 stars 6 forks source link

Problem with python3 on Debian Wheezy #10

Open sam81 opened 10 years ago

sam81 commented 10 years ago

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
jverzani commented 10 years ago

@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.

oprypin commented 10 years ago

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()...

jverzani commented 10 years ago

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

On Tue, Jul 8, 2014 at 2:28 PM, Oleh Prypin notifications@github.com 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 verzani@math.csi.cuny.edu

sam81 commented 10 years ago

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

jverzani commented 10 years ago

Thanks again!

On Tue, Jul 8, 2014 at 3:11 PM, Samuele Carcagno notifications@github.com 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 verzani@math.csi.cuny.edu