Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Flask #36

Open
MagnusOxlund opened this issue Jan 19, 2024 · 2 comments
Open

Compatibility with Flask #36

MagnusOxlund opened this issue Jan 19, 2024 · 2 comments

Comments

@MagnusOxlund
Copy link

I've been trying to use watch with Flask, but the output doesn't appear in the terminal until after the Flask application has terminated.

from watchpoints import watch
from flask import Flask

app = Flask('app')

x = None
watch(x)

@app.route('/')
def change_x():
	global x
	x = "Something"		# no output until after app.run terminates
	print("manual print")	# prints immediately
	return x

app.run('0.0.0.0', 500, debug=True, use_reloader=True)

Is there a way to output immediately?

@gaogaotiantian
Copy link
Owner

Ah, that's actually a bug for watchpoints. watchpoints does not deal with global variables well. Also I'll have to be honest that this library has not been actively maintained. Personally I loved this black magic library but not there are not a lot of active users to make maintenance worthy.

@MagnusOxlund
Copy link
Author

I'm surprised to hear that. I can't imagine a better way to monitor variables that are involved in a complex interaction. Personally, I'm dealing with cached quasi-global proxy objects and hooks or signals being accessed by external modules I'm still getting to know. It can take quite a while to track down issues.

I only just discovered your project yesterday. Hopefully it will garner more attention and catch on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants