Could it be a bug of PyCall or PyPlot?

130 views
Skip to first unread message

Jerry Xiong

unread,
Mar 9, 2015, 2:31:58 PM3/9/15
to julia...@googlegroups.com
When I ran below codes:

using PyCall
@pyimport pylab as plb
cmap1
=plb.get_cmap("jet")
pycall
(cmap1,PyAny,0.5)
Every thing goes fine, output result (0.4901960784313725,1.0,0.4775458570524984,1.0)

However, after I loaded PyPlot:
require("PyPlot")
cmap2
=plb.get_cmap("jet")
pycall
(cmap2,PyAny,0.5)
A error is occured:
ERROR: `pycall` has no method matching pycall(::ColorMap, ::Type{PyAny}, ::Float64)

I found cmap1 is a PyObject, but cmap2 is another type called ColorMap. There is no any element named plb in PyPlot, so importing PyPlot should be independent from the previously imported module plb, therefore cmap1 should equal to cmap2. How could it happen?


Jerry Xiong

unread,
Mar 9, 2015, 2:49:38 PM3/9/15
to julia...@googlegroups.com
My Julia version is :

Julia Version 0.3.6
Commit 0c24dca* (2015-02-17 22:12 UTC)
Platform Info:
  System: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Xeon(R) CPU E7- 4830  @ 2.13GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Nehalem)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

Big Stone

unread,
Mar 9, 2015, 4:01:11 PM3/9/15
to julia...@googlegroups.com
same thing here under Windows and julia 0.3.5

Steven G. Johnson

unread,
Mar 9, 2015, 5:18:52 PM3/9/15
to julia...@googlegroups.com


On Monday, March 9, 2015 at 2:31:58 PM UTC-4, Jerry Xiong wrote:
When I ran below codes:

using PyCall
@pyimport pylab as plb
cmap1
=plb.get_cmap("jet")
pycall
(cmap1,PyAny,0.5)
Every thing goes fine, output result (0.4901960784313725,1.0,0.4775458570524984,1.0)

However, after I loaded PyPlot:
require("PyPlot")
cmap2
=plb.get_cmap("jet")
pycall
(cmap2,PyAny,0.5)
A error is occured:
ERROR: `pycall` has no method matching pycall(::ColorMap, ::Type{PyAny}, ::Float64)

Yes, I should probably define a "pycall" method for ColorMap.   For now, you can do pycall(cmap2.o, PyAny, 0.5).

Steven G. Johnson

unread,
Mar 9, 2015, 5:24:22 PM3/9/15
to julia...@googlegroups.com


On Monday, March 9, 2015 at 5:18:52 PM UTC-4, Steven G. Johnson wrote:
Yes, I should probably define a "pycall" method for ColorMap.   For now, you can do pycall(cmap2.o, PyAny, 0.5).

Just fixed it in PyCall (master branch on github).

Steven G. Johnson

unread,
Mar 9, 2015, 5:24:42 PM3/9/15
to julia...@googlegroups.com
I mean in PyPlot. 

Jerry Xiong

unread,
Mar 10, 2015, 11:10:25 AM3/10/15
to julia...@googlegroups.com
Many thanks!
Reply all
Reply to author
Forward
0 new messages