cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

Archicad Python API
About automating tasks in Archicad using the Python API.
SOLVED!

Archicad 24 - Python

JSN
Enthusiast
1) Is it possible that I cannot add the Python palette to any toolbar as it is an exerimental feature?

2) Here (https://graphisoft.com/downloads/python#try) the example "Excel file import" seems to be wrongly linked as it leads to the Excel file export example when you hit download.

3) Are the Python Snippets from the experimental addon for 23.3000 not supported anymore as I get several traceback errors or might this be a general permiossion issue of my IT system?
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Dear Guys,

Our Room Report Generator script uses openpyxl PyPI package to import/export Excel files. This is one of the biggest advantages of python, plenty of libraries are available. Our python scripts automatically install the latest version of dependent python packages.
Unfortunately the developers of openpyxl published a new version (3.0.4) which contains a bug. Now we reported this issue to the developers of openpyxl, hopefully they will fix it soon.
So when you ran our room_report.py script and it detected that openpyxl is not installed on your computer, the latest buggy version was installed.

The good news is that you don't have to wait till a new version of openpyxl comes out, because you can downgrade to the previous version (3.0.3):
Open a Command Prompt on Windows or a Terminal on macOS and execute the following commands:
pip3 uninstall openpyxl
After this first command it will ask for a confirmation, type in y to proceed.
pip3 install -Iv openpyxl==3.0.3
In-house at Graphisoft our tests used (and still uses) the previous version of openpyxl (3.0.3), that's the reason why our tests passed and we didn't detect this issue. We have to fix our tests to always use the latest 3rd party libraries.

Thank you very much for reporting us this issue!

View solution in original post

14 REPLIES 14
TMA_80
Enthusiast
From the getting started pdf ( it is somhow strange to announce a feature and make it invisible ?!!!) :

To use Python Palette, switch on the Python Palette Experimental Feature on the Work Environment dialog. The palette can be opened from the Palettes menu.
1. Launch ARCHICAD
2. Go to Options > Work Environment > More Options
3. Under Experimental Features, switch on "Enable Python Palette" checkbox
4. Open the Python Palette from Window > Palettes > Python Palette


[edit:] even if it is activitated, it is still impossible to add the python to an existing or new palette
AC12_20 |Win10_64bit|
poco2013
Mentor
JSN wrote:
3) Are the Python Snippets from the experimental addon for 23.3000 not supported anymore as I get several traceback errors or might this be a general permiossion issue of my IT system?
FYI:

The Python Snippets from the experimental version are not supported in the new version in 24. The new version uses a http: interface which can be used either internally in Archicad or completely external with a open Archicah instance.

However, the old experimental snippets can be easily modified to work by just adding the appreciate "connect" commands to open the interface.

A revised (new) excel example is given on the new Python site which will accomplish this.

https://graphisoft.com/downloads/python

Do You have any specific questions?
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
JSN
Enthusiast
TMA_80 wrote:
From the getting started pdf ( it is somhow strange to announce a feature and make it invisible ?!!!) :

To use Python Palette, switch on the Python Palette Experimental Feature on the Work Environment dialog. The palette can be opened from the Palettes menu.
1. Launch ARCHICAD
2. Go to Options > Work Environment > More Options
3. Under Experimental Features, switch on "Enable Python Palette" checkbox
4. Open the Python Palette from Window > Palettes > Python Palette

Yes, that's clear. Now I wanted to put the icon on my customized toolbar. However, this does not work as seen in the screenshot.
JSN
Enthusiast
poco2013 wrote:
JSN wrote:
3) Are the Python Snippets from the experimental addon for 23.3000 not supported anymore as I get several traceback errors or might this be a general permiossion issue of my IT system?
FYI:

The Python Snippets from the experimental version are not supported in the new version in 24. The new version uses a http: interface which can be used either internally in Archicad or completely external with a open Archicah instance.

However, the old experimental snippets can be easily modified to work by just adding the appreciate "connect" commands to open the interface.

A revised (new) excel example is given on the new Python site which will accomplish this.

https://graphisoft.com/downloads/python

Do You have any specific questions?
- Ah yes thx for pointing this out, I will check this out out by modifying the experimental scripts later.

- I have found the example page and just wanted to notify that the Excel Import Example download link does not work as expected as it gives me the same file as the previous link for the Excel Export Example and therefore there is no excel_import.py in the folder ....

- Moreover the "Room Data Sheet Export" example throws me back some errors which may or may not related to my system but let me just copy here the error code.
Traceback (most recent call last):
  File "C:\Test\Room report generator test\room_report.py", line 198, in <module>
    wbFiller.SaveWorkbook(outputPath)
  File "C:\Test\Room report generator test\room_report.py", line 116, in SaveWorkbook
    self._fillWorkbook(workbook)
  File "C:\Test\Room report generator test\room_report.py", line 169, in _fillWorkbook
    worksheet = workbook.copy_worksheet(base)
  File "C:\Program Files\Python37\lib\site-packages\openpyxl\workbook\workbook.py", line 419, in copy_worksheet
    cp.copy_worksheet()
  File "C:\Program Files\Python37\lib\site-packages\openpyxl\worksheet\copier.py", line 41, in copy_worksheet
    self.target.merged_cells = copy(self.source.merged_cells)
  File "C:\Program Files\Python37\lib\copy.py", line 88, in copy
    return copier(x)
  File "C:\Program Files\Python37\lib\site-packages\openpyxl\worksheet\cell_range.py", line 503, in __copy__
    n.ranges.append(copy(r))
  File "C:\Program Files\Python37\lib\copy.py", line 88, in copy
    return copier(x)
  File "C:\Program Files\Python37\lib\site-packages\openpyxl\worksheet\cell_range.py", line 150, in __copy__
    title=self.title)
TypeError: __init__() got an unexpected keyword argument 'min_col'

=== Process aborted ===
Seems like that it files to write the file, but the "Excel Export" script is workwing flawlessly so I don't think that it is lacking permissions. Maybe someone can tell me more about where to continue investigating. Thx!
poco2013
Mentor
I'm getting the same errors for the room report. Seems to be failing on Opepyxl function __copy__ with error unexpected keyword argument 'min_col' All the other trace backs are just getting there.

Maybe different versions? I expect Archicad will have to troubleshoot
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
TMA_80
Enthusiast
I've got the same error and, also , yes, it is obviously, impossible to add the python to an existing or a new palette ( a bug or an intentionnal limitation ?)
AC12_20 |Win10_64bit|
JSN
Enthusiast
Ok, well so at least everybody fails attempting the things mentioned previously and it seems like now it's Graphisoft's turn.
Minh Nguyen
Graphisoft Alumni
Graphisoft Alumni
Hi All,

Thank you for your question and your enthusiasm with Python!

First, the Excel File Importer link on our website must be incorrect. Here should be the correct link: https://graphisoft.com/dl/Python/Excel%20file%20importer.zip

Regarding the error with Room Report Generator script, unfortunately, I encounter the same issue! Let me forward this question to our developers for further investigation. As soon as I have an answer, I will let you know!

Thank you very much!

Best regards,
Minh

Minh Nguyen
Technical Support Engineer
GRAPHISOFT

Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Dear Guys,

Our Room Report Generator script uses openpyxl PyPI package to import/export Excel files. This is one of the biggest advantages of python, plenty of libraries are available. Our python scripts automatically install the latest version of dependent python packages.
Unfortunately the developers of openpyxl published a new version (3.0.4) which contains a bug. Now we reported this issue to the developers of openpyxl, hopefully they will fix it soon.
So when you ran our room_report.py script and it detected that openpyxl is not installed on your computer, the latest buggy version was installed.

The good news is that you don't have to wait till a new version of openpyxl comes out, because you can downgrade to the previous version (3.0.3):
Open a Command Prompt on Windows or a Terminal on macOS and execute the following commands:
pip3 uninstall openpyxl
After this first command it will ask for a confirmation, type in y to proceed.
pip3 install -Iv openpyxl==3.0.3
In-house at Graphisoft our tests used (and still uses) the previous version of openpyxl (3.0.3), that's the reason why our tests passed and we didn't detect this issue. We have to fix our tests to always use the latest 3rd party libraries.

Thank you very much for reporting us this issue!