<?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: Compile Python Scripts to Executables in Archicad Python API</title>
    <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/577367#M940</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/73852"&gt;@wkrt-hs&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying to compile my Python scripts to executables using pyinstaller.&lt;BR /&gt;Unfortunately, the executables seem to fail to connect to Archicad.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Dear Wenzel, you could try my script `archiconnect.py` which doesn't use the official Graphisoft &lt;A title="Python binding for the Archicad JSON command interface" href="https://pypi.org/project/archicad/" target="_blank" rel="noopener"&gt;archicad&lt;/A&gt; package, but could be used for connection testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;How to test&lt;/H3&gt;
&lt;P&gt;Download latest&amp;nbsp;&lt;A title="Archicad Connect" href="https://github.com/borshpro/archiconnect/" target="_blank" rel="noopener"&gt;archiconnect&lt;/A&gt; release from &lt;A title="Archicad Connect releases on GitHub" href="https://github.com/borshpro/archiconnect/releases" target="_blank" rel="noopener"&gt;GitHub&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Extract release and run `archiconnect.py` directly in Terminal or via Python:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;./archiconnect.py
python archiconnect.py GetAllClassificationSystems&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When running Archicad in background, you'll get output in Terminal:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;Connecting to 127.0.0.1:19723 …

Is alive: True
Host version: Archicad 27 3001 INT&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="archiconnect_powershell_windows.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/49571i0D96C7CD9AFE1661/image-size/large?v=v2&amp;amp;px=999" role="button" title="archiconnect_powershell_windows.png" alt="archiconnect_powershell_windows.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;Creating and running PyInstaller package&lt;/H3&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Build package:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;pyinstaller -F archiconnect.py&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run packed executable:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;./dist/archiconnect&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this executable does or does not work in your environment, please post a short report here so we can investigate further.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Nov 2023 12:44:27 GMT</pubDate>
    <dc:creator>GAG</dc:creator>
    <dc:date>2023-11-24T12:44:27Z</dc:date>
    <item>
      <title>Compile Python Scripts to Executables</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/396846#M390</link>
      <description>&lt;P&gt;Dear Community,&lt;/P&gt;&lt;P&gt;I'm trying to compile my Python scripts to executables using pyinstaller.&lt;BR /&gt;Unfortunately, the executables seem to fail to connect to Archicad.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from archicad import ACConnection
conn = ACConnection.connect()
assert conn&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Traceback (most recent call last):
  File "xxx", line 9, in &amp;lt;module&amp;gt;
    assert conn
AssertionError
[15984] Failed to execute script 'xxx' due to unhandled exception!&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;There's already a similar topic but it is locked:&amp;nbsp;&lt;A href="https://community.graphisoft.com/t5/Developer-forum/Compile-Python-Scripts-to-Executables/m-p/351594#M10548" target="_blank"&gt;Compile Python Scripts to Executables - Graphisoft Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Did anyone already succeed with this? Building executables should be a common usecase for automation purposes.&lt;/P&gt;&lt;P&gt;Best, Wenzel&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 14:28:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/396846#M390</guid>
      <dc:creator>wkrt-hs</dc:creator>
      <dc:date>2023-08-31T14:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Compile Python Scripts to Executables</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/577367#M940</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/73852"&gt;@wkrt-hs&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying to compile my Python scripts to executables using pyinstaller.&lt;BR /&gt;Unfortunately, the executables seem to fail to connect to Archicad.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Dear Wenzel, you could try my script `archiconnect.py` which doesn't use the official Graphisoft &lt;A title="Python binding for the Archicad JSON command interface" href="https://pypi.org/project/archicad/" target="_blank" rel="noopener"&gt;archicad&lt;/A&gt; package, but could be used for connection testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;How to test&lt;/H3&gt;
&lt;P&gt;Download latest&amp;nbsp;&lt;A title="Archicad Connect" href="https://github.com/borshpro/archiconnect/" target="_blank" rel="noopener"&gt;archiconnect&lt;/A&gt; release from &lt;A title="Archicad Connect releases on GitHub" href="https://github.com/borshpro/archiconnect/releases" target="_blank" rel="noopener"&gt;GitHub&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Extract release and run `archiconnect.py` directly in Terminal or via Python:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;./archiconnect.py
python archiconnect.py GetAllClassificationSystems&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When running Archicad in background, you'll get output in Terminal:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;Connecting to 127.0.0.1:19723 …

Is alive: True
Host version: Archicad 27 3001 INT&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="archiconnect_powershell_windows.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/49571i0D96C7CD9AFE1661/image-size/large?v=v2&amp;amp;px=999" role="button" title="archiconnect_powershell_windows.png" alt="archiconnect_powershell_windows.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;Creating and running PyInstaller package&lt;/H3&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Build package:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;pyinstaller -F archiconnect.py&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run packed executable:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;./dist/archiconnect&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this executable does or does not work in your environment, please post a short report here so we can investigate further.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2023 12:44:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/577367#M940</guid>
      <dc:creator>GAG</dc:creator>
      <dc:date>2023-11-24T12:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Compile Python Scripts to Executables</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/578841#M942</link>
      <description>&lt;P&gt;Hi George and thank you for your reply!&lt;BR /&gt;Building and running your script works fine.&lt;BR /&gt;&lt;BR /&gt;But it would still be nice to also use the official archicad package for this usecase.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 14:05:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/578841#M942</guid>
      <dc:creator>wkrt-hs</dc:creator>
      <dc:date>2023-12-04T14:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Compile Python Scripts to Executables</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/578998#M943</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/73852"&gt;@wkrt-hs&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Building and running your script works fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well, this means that you have no specific&amp;nbsp;PyInstaller issues when using generic requests.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/73852"&gt;@wkrt-hs&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;BR /&gt;But it would still be nice to also use the official archicad package for this usecase.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you could provide your script, I could check/rewrite it for compatibility with&amp;nbsp;PyInstaller.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 14:49:50 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/578998#M943</guid>
      <dc:creator>GAG</dc:creator>
      <dc:date>2023-12-05T14:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compile Python Scripts to Executables</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/579000#M944</link>
      <description>&lt;P&gt;It's literally the 3 lines from the first post that already fail.&lt;BR /&gt;Are you able to build and run them successfully in your environment?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 14:59:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/579000#M944</guid>
      <dc:creator>wkrt-hs</dc:creator>
      <dc:date>2023-12-05T14:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compile Python Scripts to Executables</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/579053#M945</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/73852"&gt;@wkrt-hs&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It's literally the 3 lines from the first post that already fail.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I already have a working solution for the simple connect (see my first comment).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/73852"&gt;@wkrt-hs&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;Are you able to build and run them successfully in your environment?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No, unfortunately, the &lt;A title="Python binding for the Archicad JSON command interface" href="https://pypi.org/project/archicad/" target="_blank" rel="noopener"&gt;official&lt;/A&gt; GS Python module doesn't work well in&amp;nbsp;&lt;SPAN&gt;PyInstaller environment and I don't have enough motivation to debug and fix their code. They suppress error messages, it's not a very good practice:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;    @staticmethod
    def find_first_port() -&amp;gt; int:
        for port in ACConnection._port_range():
            try:
                ACConnection(port)
                return port
            except Exception:
                continue
        return None

    @staticmethod
    def find_ports(ports: slice) -&amp;gt; List[int]:
        result = []
        for port in ACConnection._port_range():
            try:
                ACConnection(port)
                result.append(port)
            except Exception:
                continue
        return result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't help you if you don't want to share your code, sorry.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 22:56:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/579053#M945</guid>
      <dc:creator>GAG</dc:creator>
      <dc:date>2023-12-05T22:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Compile Python Scripts to Executables</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/579715#M947</link>
      <description>&lt;P&gt;Thanks for your response, George.&amp;nbsp;&lt;BR /&gt;I'll see if I investigate further, but it's good to know that it's probably nothing related to my python environment.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 09:37:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/579715#M947</guid>
      <dc:creator>wkrt-hs</dc:creator>
      <dc:date>2023-12-11T09:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Compile Python Scripts to Executables</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/580099#M952</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/73852"&gt;@wkrt-hs&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;but it's good to know that it's probably nothing related to my python environment.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sure )&lt;/P&gt;
&lt;P&gt;Maybe GS will fix their initialisation code to be compatible with the PyInstaller environment, but I haven't found an &lt;A title="GRAPHISOFT organisation at GitHub" href="https://github.com/orgs/GRAPHISOFT/repositories?type=source" target="_blank" rel="noopener"&gt;official GitHub&lt;/A&gt; repo for the &lt;A title="Archicad Python Interface" href="https://pypi.org/project/archicad/" target="_blank" rel="noopener"&gt;`archicad` Python module&lt;/A&gt; to create an Issue.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 08:28:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/580099#M952</guid>
      <dc:creator>GAG</dc:creator>
      <dc:date>2023-12-13T08:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Compile Python Scripts to Executables</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/608444#M1011</link>
      <description>&lt;P&gt;Not sure if this is relevant for&amp;nbsp;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/73852"&gt;@wkrt-hs&lt;/a&gt;&amp;nbsp;anymore, but I had the same problem with pyinstaller and spent 3 days trying to find the fix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What eventually worked for me was to collect the local archicad installation into the bundle, and to use these command-line flags with pyinstaller:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;pyinstaller --collect-all archicad -F &amp;lt;other arguments&amp;gt; &amp;lt;python_app.py&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I hope this helps anyone who stumbles on the same topic!&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2024 15:23:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Compile-Python-Scripts-to-Executables/m-p/608444#M1011</guid>
      <dc:creator>martti</dc:creator>
      <dc:date>2024-06-15T15:23:22Z</dc:date>
    </item>
  </channel>
</rss>

