# PyCall giving Ptr instead of PyObject

**URL:** https://discourse.julialang.org/t/pycall-giving-ptr-instead-of-pyobject/57422
**Category:** General Usage
**Created:** [March 17, 2021, 10:31pm UTC](https://discourse.julialang.org/t/pycall-giving-ptr-instead-of-pyobject/57422 "2021-03-17T22:31:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Satvik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/satvik/32/20486_2.png) [@Satvik](https://discourse.julialang.org/u/Satvik)
#### Post date: [March 17, 2021, 10:31pm UTC](https://discourse.julialang.org/t/pycall-giving-ptr-instead-of-pyobject/57422/1 "2021-03-17T22:31:59Z")

</div>

Hi,

I’m trying to load a python file that was pickled using joblib. The file is a python dict that contains several objects, including a few DataFrames. When I load the dict in Python it’s fine, but when I try to load it through PyCall the DataFrames turn into pointers like `PyObject Ptr{PyCall.PyObject_struct} @0x00007f124438c3d0`

Example code:

```julia
using PyCall
joblib = pyimport("joblib")
output_dict = joblib.load("myfile.pickle")

```

Output:

```julia
Dict{Any,Any} with 6 entries:
  "array1" => [3.84204, 3.90863, 3.91936, 4.1192, 4.13436, 4.14225…
  "array2" => Any["b544ea00d3efc43c18d34c5cbd58882340016f6c" PyObj…
  "int" => 14
  "df1" => PyObject Ptr{PyCall.PyObject_struct} @0x00007f124438…
  "df2" => PyObject Ptr{PyCall.PyObject_struct} @0x00007f12444e…
  "df3" => PyObject Ptr{PyCall.PyObject_struct} @0x00007f124433…

```

Is there a way to recover the Python object from these pointers?

I attempted to create an MWE, but couldn’t reproduce the issue – saving and loading a dataframe worked correctly.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [March 18, 2021, 1:04am UTC](https://discourse.julialang.org/t/pycall-giving-ptr-instead-of-pyobject/57422/2 "2021-03-18T01:04:01Z")

</div>

Python objects _are_ stored as pointers. Normally, however, PyCall displays an object via the Python `repr` of that object, and only shows the raw pointer [when `repr` throws an exception](https://github.com/JuliaPy/PyCall.jl/blob/5d227fc23fda631783a68c9ff1c6aff47200978e/src/PyCall.jl#L232-L254).

To see what exception is preventing the `repr` from being displayed, try calling `pyrepr(output_dict["df1"])`.

---

<div class="post-metadata">

### Author: ![Satvik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/satvik/32/20486_2.png) [@Satvik](https://discourse.julialang.org/u/Satvik)
#### Post date: [March 18, 2021, 1:53am UTC](https://discourse.julialang.org/t/pycall-giving-ptr-instead-of-pyobject/57422/3 "2021-03-18T01:53:00Z")

</div>

Thanks! It turns out I built my PyCall with the wrong environment, which had led it to use an older version of pandas, which throws an exception when you try to view a dataframe from a newer version.
