Debugging scripts - Console does not printout anything

Hi,

I might do this wrong but running my python pluggin with these lines,

  • nothing show up in the console
  • loading my script in the console, has no option to debug or launch it

thanks for helping me out on this

import pcbnew
import os
import math
import logging
logging.debug(f"TEST TEST TEST")
print(f"TEST2 TEST2 TEST2")

The KiPython scripting console isn’t an output console for the plugins. You have to set up logging in your plugin in the same way than in any python program.

:frowning:
ok , thanks

but why the possibility to open files ?

I must be doing something wrong, but nothing is working

I tried different path, I never see any log file created anywhere

import logging

script_dir = "P:\\Program Files\\KiCad\\8.0\\bin\\"
# "W:\\MY\\SCRITPTS\\" 
# os.path.dirname(os.path.abspath(__file__))

log_file = os.path.join(script_dir, 'pcbnew_log.txt')
#log_file = os.path.expanduser("~/Documents/pcbnew_log.txt")

logging.basicConfig(
    filename=log_file,  # File where logs will be written
    level=logging.INFO,  # Log level (INFO, WARNING, ERROR)
    format='%(asctime)s - %(levelname)s - %(message)s'  # Log format
)

logging.info('Logging successfully initialized.')

ok got it working in the Documents folder IF I load kicad from the cmd line (wtf…)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.