question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

call stack is not deep enough (Cython)

See original GitHub issue

Hi @Delgan

When using loguru 0.2.5 inside python script it works as expected, but when i compile this file to an executable using Cython i get this error and program terminates : call stack is not deep enough

More info of the error :

Traceback (most recent call last):
  File "test_layer.py", line 66, in init test_layer
    logger.warning('just test')
  File "/usr/local/lib/python3.5/dist-packages/loguru/_logger.py", line 1406, in log_function
    frame = get_frame(_self._depth + 1)
ValueError: call stack is not deep enough

Do you have any idea why ?

I tried increasing the execution depth limit inside the script that i import loguru by using sys.setrecursionlimit(3000) but still issue remains…

OS: raspbian stretch lite Cython-0.29.7

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Delgancommented, Apr 17, 2019

@djsakisd As .opt() actually returns a logger object, you can add logger = logger.opt(depth=-1) at the start of your file, and then use this new logger without needing to call opt() every time.

I will investigate this issue, hopefully you will not even need this workaround in the next version. 👍

1reaction
Delgancommented, Apr 16, 2019

Hi @djsakisd.

This is not related to the recursion limit, but to sys._getframe() which tries to access frame of the call site to extract logging information. Typically, this error indicates that loguru tried to access a frame which does not exist.

You may play with the depth option to see if some negative values fixes the problem:

logger.opt(depth=-1).info("Working?")

On my side, I will try to reproduce the error, I actually never tested Cython, so I’m not too surprised there is some incompatibilities dealing with stack frames.

Read more comments on GitHub >

github_iconTop Results From Across the Web

call stack is not deep enough" when calling IPython.embed ...
A solution is to insert a new frame created with PyFrame_New, but it is outside the documented Python C API. #include <Python.h> #include ......
Read more >
call stack is not deep enough when import matplotlib.pyplot as ...
Works fine here. Looks like a python/matplotlib installation error. Does it work from the python prompt?
Read more >
Developers - call stack is not deep enough (Cython) - - Bountysource
Hi @Delgan. When using loguru 0.2.5 inside python script it works as expected, but when i compile this file to an executable using...
Read more >
[Solved] Many occurrences of error message '(call stack is not ...
I get a lot of error messages '(call stack is not deep enough)' while using FreeCAD 0.19. This looks like a bug to...
Read more >
A breakdown of Cython basics - CallMiner
Python already has the ability to call external C/C++ code from Python. Cython ... And with libraries like numpy, Python's performance can be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found