Giter VIP home page Giter VIP logo

Comments (6)

filipre avatar filipre commented on July 28, 2024

Possibly related, but the exception is different and the error happens every time, regardless if it is a syntax error or not: #213

from functions-framework-python.

KaylaNguyen avatar KaylaNguyen commented on July 28, 2024

Hi @filipre, this seems to be a VS Code issue: https://stackoverflow.com/q/52372810. It's not related to #213.
Can you try the workaround suggested and see if that works for you?

from functions-framework-python.

filipre avatar filipre commented on July 28, 2024

Thank you for your reply. The Stackoverflow thread shifts the question to "Why does the CLI debugger finishes with the exit code 3"? VS Code will always throw an exception, when python finishes with an error code. I think that's the correct behavior. For example, this code should not throw an exception

sys_exit(0)

But this one should

sys_exit(1)

I could disable "Uncaught Exceptions" but I do not want this because I would also ignore exceptions in my program code.

The exact line that causes the system exit 3 is

run_module_as_main(options.target, alter_argv=True)

and options.target is 'functions_framework'. The method is defined (?) in runpy somewhere. The sys.path looks correct, too and refers to the right virtual env packages and custom packages.

Is there something else I could provide to figure out the root of the problem?

from functions-framework-python.

filipre avatar filipre commented on July 28, 2024

I created https://github.com/filipre/vscode-debugger-exit-3-bug to debug the issue

Here are some observations:

  • I think run_module_as_main always exits with error code 3 and not just sometimes.
  • If I uncheck "Raised Exception", "Uncaught Exception" and "User Uncaught Exception", the debugger restarts without raising an exception
  • If I then check "User Uncaught Exceptions", I can restart the debugger once but not twice or more times
  • If I check "Uncaught Exceptions", it always raises an exception.

Maybe after changing a file, system_frameworks does not "properly" stop the debugger and causes the exit code?

from functions-framework-python.

fswair avatar fswair commented on July 28, 2024

this error all about library's trigger method.

there is a default "trigger_reload" method and it raises SystemExit when file has been changed.

def trigger_reload(self, filename: str) -> None: self.log_reload(filename) sys.exit(3) #ย just make it disable in source code

or

`def your_trigger_method(fn): pass

reloader.trigger_reload = your_trigger_method`

from functions-framework-python.

filipre avatar filipre commented on July 28, 2024

this error all about library's trigger method.

Which library do you mean? functions-framework or something else?

from functions-framework-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.