<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python Add In Logging Window in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/python-add-in-logging-window/m-p/10055913#M9492</link>
    <description>&lt;P&gt;You might take a look at my &lt;A href="https://plugins.jetbrains.com/plugin/11343-fusion-360-scripting" target="_self"&gt;fusion add-in&lt;/A&gt; for intellij IDEA. It wraps stdout, so anything you log in the add-in goes to the terminal in IDEA. It's pretty convenient during development! But it does involve setting up a completely separate development environment (IDEA instead of VSCode), so maybe not worth it if you just want logging.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2021 03:04:50 GMT</pubDate>
    <dc:creator>JesusFreke</dc:creator>
    <dc:date>2021-02-04T03:04:50Z</dc:date>
    <item>
      <title>Python Add In Logging Window</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/python-add-in-logging-window/m-p/10054877#M9489</link>
      <description>&lt;P&gt;What are the options for adding in a window with which I can log progress / output of python scripts?&amp;nbsp; I'm not seeing anything obvious in the userInterface API, but, alas, have not plumbed the depths.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having a script / stdout window would be a huge boon to development on more complicated scripts.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 18:34:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/python-add-in-logging-window/m-p/10054877#M9489</guid>
      <dc:creator>mpieper</dc:creator>
      <dc:date>2021-02-03T18:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Python Add In Logging Window</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/python-add-in-logging-window/m-p/10055603#M9490</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7316372"&gt;@mpieper&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use the TextCommands output palette.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;def dumpMsg(msg :str):
    adsk.core.Application.get().userInterface.palettes.itemById('TextCommands').writeText(str(msg))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;This is convenient because you can see the progress without leaving the GUI.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 23:36:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/python-add-in-logging-window/m-p/10055603#M9490</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2021-02-03T23:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Python Add In Logging Window</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/python-add-in-logging-window/m-p/10055884#M9491</link>
      <description>&lt;P&gt;Okay so that's getting me closer.&lt;/P&gt;&lt;P&gt;Direct pings to the function work.&amp;nbsp; I'd like to wrap it in a handler so I can just use logging like I normally would. e.g.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import logging
import adsk.core, adsk.fusion, adsk.cam, traceback

class Fusion360Handler(logging.Handler):
    def emit(self, record):
        msg = self.format(record)
        adsk.core.Application.get().userInterface.palettes.itemById('TextCommands').writeText(str(msg))

def run(context):
    #Grab local logger (NOTE: Cannot put this out of function scope)
    logger = logging.getLogger(__name__)
    logger.setLevel(logging.DEBUG)

    #Instantiate handler, set level, and add to logger.
    handler = Fusion360Handler()
    handler.setLevel(logging.DEBUG)
    logger.addHandler(handler)

    logger.info("HELLO") #THIS FAILS&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a basic dumb sample script.&amp;nbsp; It's failing due to there being A LOT of extra loggers floating around with similar names / there seems to be multiple entries into the "run" function (e.g. enter into the function "run" multiple times)?&amp;nbsp; I pared it down a little further by forcing the logger to take a unique instance/name, and even then it bugs out on logger.info.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Line 1524, in handle  self.callHandlers(record)  File "C:\Users\mpiep\AppData\Local\Autodesk\webdeploy\production\c1a39fe96c80078ad566b938d0f03989f4b85b09\Python\lib\logging\__init__.py", line 1585, in callHandlers  if record.levelno &amp;gt;= hdlr.level: AttributeError: type object 'Fusion360Handler' has no attribute 'level'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Despite me looking at the handler directly and confirming it does in fact have a level attribute.&amp;nbsp; I have not looked under the covers to see how these scripts are patched in....&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 02:47:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/python-add-in-logging-window/m-p/10055884#M9491</guid>
      <dc:creator>mpieper</dc:creator>
      <dc:date>2021-02-04T02:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python Add In Logging Window</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/python-add-in-logging-window/m-p/10055913#M9492</link>
      <description>&lt;P&gt;You might take a look at my &lt;A href="https://plugins.jetbrains.com/plugin/11343-fusion-360-scripting" target="_self"&gt;fusion add-in&lt;/A&gt; for intellij IDEA. It wraps stdout, so anything you log in the add-in goes to the terminal in IDEA. It's pretty convenient during development! But it does involve setting up a completely separate development environment (IDEA instead of VSCode), so maybe not worth it if you just want logging.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 03:04:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/python-add-in-logging-window/m-p/10055913#M9492</guid>
      <dc:creator>JesusFreke</dc:creator>
      <dc:date>2021-02-04T03:04:50Z</dc:date>
    </item>
  </channel>
</rss>

