Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plug-in help
#5
Hi,
You can create an error file and use the sys pipeline to get runtime feedback. Obviously you'll want to delete this code after the plug-in is stable and finished. You can put the code anywhere in your plug-in. I like to put the code at the beginning of the plug-in.
Code:
# _______________________________________________________________
# Open an error file. It will capture error output.
# The file will also take 'print' output.
import time                         # noqa
error_file = sys.stdout = sys.stderr = open("C:\\error.txt", 'a')
print("\nStart debug,", time.ctime(), "_" * 30, "\n")
# ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


It's not entirely necessary to close the error file, but I've had trouble with it closing with certain errors. Try closing the file before exiting the plug-in.
Code:
# This is better than letting the OS close the file.
error_file.close()

I don't know your coding experience, but VS Code will help you catch frustrating errors and teach useful code habbits.
Reply


Messages In This Thread
Plug-in help - by Deedolith - 01-07-2025, 05:28 PM
RE: Plug-in help - by programmer_ceds - 01-07-2025, 06:39 PM
RE: Plug-in help - by Deedolith - 01-07-2025, 07:45 PM
RE: Plug-in help - by Ofnuts - 01-07-2025, 10:41 PM
RE: Plug-in help - by gasMask - 01-08-2025, 08:45 AM
RE: Plug-in help - by MrsP-from-C - 01-08-2025, 03:43 PM
RE: Plug-in help - by gasMask - 01-09-2025, 09:18 AM
RE: Plug-in help - by Deedolith - 01-08-2025, 04:48 PM
RE: Plug-in help - by Ofnuts - 01-09-2025, 02:03 AM
RE: Plug-in help - by MrsP-from-C - 01-08-2025, 06:36 PM
RE: Plug-in help - by Deedolith - 01-08-2025, 06:40 PM
RE: Plug-in help - by MrsP-from-C - 01-08-2025, 06:51 PM
RE: Plug-in help - by MrsP-from-C - 01-09-2025, 09:49 AM

Forum Jump: