# PyError when using PyCall

**URL:** <https://discourse.julialang.org/t/pyerror-when-using-pycall/85731>\
**Category:** General Usage\
**Tags:** error-message\
**Created:** [August 14, 2022, 3:05pm UTC](https://discourse.julialang.org/t/pyerror-when-using-pycall/85731 "2022-08-14T15:05:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hdroms](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hdroms](https://discourse.julialang.org/u/hdroms)\
**Post date:** [August 14, 2022, 3:05pm UTC](https://discourse.julialang.org/t/pyerror-when-using-pycall/85731/1 "2022-08-14T15:05:35Z")

</div>

I have been attempting to do video analysis using python’s hnccorr algorithm. The particular script thats throwing this error use to work, though when it was handed off to me it started throwing this error which thus far I have been unable to figure out how to fix.

I have done complete updates on all languages and done reinstalls on the packages being used to see if it was something to do with older versions, none of that proved fruitful. I have also attempted this script on Windows, Linux and Mac. Both Linux and Mac throw this error, while the windows machine just never stops running almost like its stuck somewhere.

If anyone has seen this, or has any clever way of solving it on any of the above operating systems I would appreciate the help.

```julia
PyError ($(Expr(:escape, :(ccall(#= /Users/user/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'BlockingIOError'>
BlockingIOError(35, 'write could not complete without blocking', 114)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/hnccorr/base.py", line 230, in segment
    print(

Stacktrace:
  [1] pyerr_check
    @ ~/.julia/packages/PyCall/7a7w0/src/exception.jl:62 [inlined]
  [2] pyerr_check
    @ ~/.julia/packages/PyCall/7a7w0/src/exception.jl:66 [inlined]
  [3] _handle_error(msg::String)
    @ PyCall ~/.julia/packages/PyCall/7a7w0/src/exception.jl:83
  [4] macro expansion
    @ ~/.julia/packages/PyCall/7a7w0/src/exception.jl:97 [inlined]
  [5] #107
    @ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:43 [inlined]
  [6] disable_sigint
    @ ./c.jl:458 [inlined]
  [7] __pycall!
    @ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:42 [inlined]
  [8] _pycall!(ret::PyObject, o::PyObject, args::Tuple{PyObject}, nargs::Int64, kw::Ptr{Nothing})
    @ PyCall ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:29
  [9] _pycall!
    @ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:11 [inlined]
 [10] #_#114
    @ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:86 [inlined]
 [11] (::PyObject)(args::PyObject)
    @ PyCall ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:86
 [12] segment(name::String, framepath::String; kwargs::Base.Pairs{Symbol, Real, NTuple{4, Symbol}, NamedTuple{(:postprocessor_min_cell_size, :postprocessor_max_cell_size, :postprocessor_preferred_cell_size, :percentage_of_seeds), Tuple{Int64, Int64, Int64, Float64}}})
    @ Main ~/Desktop/user/filepath:12
 [13] top-level scope
    @ ./timing.jl:220 [inlined]
 [14] top-level scope
    @ ./In[7]:0
 [15] eval
    @ ./boot.jl:373 [inlined]
 [16] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1196 

```

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [August 16, 2022, 11:54pm UTC](https://discourse.julialang.org/t/pyerror-when-using-pycall/85731/2 "2022-08-16T23:54:53Z")

</div>

> [@hdroms](#):
>
> `BlockingIOError(35, 'write could not complete without blocking', 114)`

The issue appears to be an error thrown from Python: see

> **[Built-in Exceptions](https://docs.python.org/3.10/library/exceptions.html#BlockingIOError)**
>
> In Python, all exceptions must be instances of a class that derives from BaseException. In a try statement with an except clause that mentions a particular class, that clause also handles any excep...

---

<div class="post-metadata">

**Author:** ![hdroms](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hdroms](https://discourse.julialang.org/u/hdroms)\
**Post date:** [August 17, 2022, 1:39am UTC](https://discourse.julialang.org/t/pyerror-when-using-pycall/85731/3 "2022-08-17T01:39:41Z")

</div>

Hello jd-foster,

Thank you for looking into it. We ended up finding that a print statement within the python package was causing the blocking error, once it was removed the code ran smoothly.
