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

avoid spamming by outputting state only once when a file changes #2049

Merged

Conversation

mmerickel
Copy link
Member

This reduces the output to only when a file changes. However, I'm able to get it into a weird state where it keeps spamming and I haven't figured out the fix for that yet.

  1. start pserve --reload
  2. save a syntax error to file A.py
  3. save file B.py with no changes
  4. you will see a continued output of "B.py changed ..." on the console.

It doesn't happen every time but it's somewhat consistent for me (especially when B.py is pserve.py).

@digitalresistor
Copy link
Member

👍

try:
py_compile.compile(filename, doraise=True)
except py_compile.PyCompileError:
print("%s has a SyntaxError; NOT reloading." % filename)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather print the message for all files in self.syntax_error_files here, just to be explicit what is blocking the reload.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay cool, I'll mess with that for a few and see how it feels. The reason I like it the way it is right now is that you only get notifications on the files that actually changed which I think it's somewhat intuitive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the information you're looking for is what files to fix to get reloader to work again

@domenkozar
Copy link
Member

One nitpick, otherwise 👍

@mmerickel
Copy link
Member Author

Ok new version prints out the syntax error for the new file as well as the names of all the files that have errors. Printing out all the files really doesn't feel quite right but it's not a big deal since most people should only have one or two files with errors at a time.

@mmerickel
Copy link
Member Author

I created a temp file that py_compile uses to avoid changing the actual pyc file. It seems to have fixed the infinite loop issues.

@domenkozar
Copy link
Member

Shipit

On Fri, 13 Nov 2015, 19:53 Michael Merickel notifications@github.com
wrote:

I created a temp file that py_compile uses to avoid changing the actual
pyc file. It seems to have fixed the infinite loop issues.


Reply to this email directly or view it on GitHub
#2049 (comment).

mmerickel added a commit that referenced this pull request Nov 13, 2015
avoid spamming by outputting state only once when a file changes
@mmerickel mmerickel merged commit e3fda6f into pserve_reload_syntaxerror_handler Nov 13, 2015
@mmerickel mmerickel deleted the fix/pserve-reload-verbosity branch November 13, 2015 19:03
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

Successfully merging this pull request may close these issues.

None yet

3 participants