Support Forum

[Frage] NemAll_Python_Geometry.html not found exception [Gelöst]


Hello!

I want to create my own PythonParts, but first I need to figure out how to debug existing stuff. So now I am trying to debug some examples with Visual Studio Code. After a lot of trial and error, I finally have my workspace in VS Code. Now I want to execute the "Attach to Allplan (workspace)", but I get an exception, saying the NemAll_Python_Geometry.html is not found/missing (see attachment).

I have no clue what I am doing wrong, can someone please help?
Thanks in advance!

Anhänge (1)

Typ: image/png
43-mal heruntergeladen
Größe: 283,94 KiB

Lösung anzeigen Lösung verbergen

Hi Melanie,

I suppose you get the error I attached. And I assume, that the configuration of your attach action in VS code looks like this:

            "name": "Attach to Allplan",
            "port": 5678,
            "host": "localhost",
            "request": "attach",
            "type": "python",
            "justMyCode": false,

If that is the case, before you attach to Allplan, you must start the PythonPart StartPythonDebug from the Examples/PythonParts/ToolsAndStartExamples. When the window pop up, you hit OK. From that moment on, Allplan is listening for a debugger to attach to it. You can tell that, because Allplan is stuck at the moment - you can't do anything.

So, when the pop-up window is closed by hitting OK, you can start "Attach to Allplan" in VS-Code.

Allplan is listening on the port 5678, so also make sure, that this port is not blocked on your PC by any firewall or so.

Best,
Bart

Anhänge (1)

Typ: image/png
0-mal heruntergeladen
Größe: 6,28 KiB
1 - 10 (11)

Hi,

The full examples can be found here

Next, you must create your workspace.

Here the steps for debugging your code.

Best
Christophe

Hi,
thanks for the response!
when I execute the StartPythonDebug, I get the error in the attachment.
I tried to find the stack trace, which is apparently in the tmp folder, but there is nothing there. I know I need to set the output to a file, but that options is somehow not available (see second attachment)

Anhänge (2)

Typ: image/png
34-mal heruntergeladen
Größe: 16,38 KiB
Typ: image/png
27-mal heruntergeladen
Größe: 27,41 KiB

trace window can be open with Ctrl + F3 (no need to restart)

Anhänge (1)

Typ: image/png
13-mal heruntergeladen
Größe: 13,83 KiB

This is what the output looks like if i execute the StartPythonDebug:

Anhänge (1)

Typ: image/png
31-mal heruntergeladen
Größe: 33,41 KiB

Unfortunately I don't see any information on what is blocking

Zitiert von: melanieernst
This is what the output looks like if i execute the StartPythonDebug:

Please provide us full trace. Best solution would be to attach the allplan_python.out file to your post.
  • open the trace options by pressing CTRL + F3
  • select the check box: write to file
  • do the stuff, that leads to the error
  • close the error and close Allplan
  • the output, that Christope asks for, is now in the allplan_python.out file which is in the Tmp directory

To get to the Tmp directory, do following:

  • open Allmenu
  • Go to: Service -> File explorer -> My own temporary CAD data

I hope we can then help you.
Best!

Thanks @bmarciniec!
Now there is some more information:

** some frozen import stuff **
Read pyp file: c:\programdata\nemetschek\allplan\2024\etc\examples\pythonparts\toolsandstartexamples\startpythondebug.pyp

=======================================================================================================

String table error:

Filename c:\programdata\nemetschek\allplan\2024\etc\examples\pythonparts\toolsandstartexamples\startpythondebug_deu.xml does not exist

=======================================================================================================

Traceback (most recent call last):
File "C:\ProgramData\Nemetschek\Allplan\2024\Etc\PythonPartsFramework\GeneralScripts\BuildingElementInputService.py", line 55, in create_element
create_ele_result = create_element(input_data.build_ele_list[0],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Nemetschek\Allplan\2024\Etc\PythonPartsExampleScripts\ToolsAndStartExamples\StartPythonDebug.py", line 83, in create_element
if debugpy.is_client_connected():
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'debugpy' has no attribute 'is_client_connected'

This error might be caused either by an older version of the debugpy installed in your environment or incorrect installation.

I assume, you have installed the debugpy with the InstallPythonPackage tool. If not, do it.

The debugpy should be then available in:

..\Etc\PythonParts-site-packages\debugpy\

Have a look in this directory, whether the debugpy is installed there and, most importantly, if the installed version is the 1.8.0 (checkout the file ...\debugpy\_version.py). If not, delete the package and install it again.

Also make sure, that there is no debugpy installed in other locations:

...\Prg\Python
...\Prg\Python\Lib
...\Etc\PythonParts-site-packages
...\Prg\Python\Lib\site-packages
...\Prg\Python\DLLs
...\Etc\PythonPartsFramework
...\Etc\PythonPartsFramework\GeneralScripts
...\Etc\PythonPartsScripts
...\Etc\PythonPartsExampleScripts
...\Etc\VisualScripts
...\Etc\VisualScripts\NodeLib\Classic Library
...\Etc\VisualScripts\NodeLib\Deprecated Library
...\Etc\VisualScripts\NodeLib\Modernized Library
...\Etc\Scripts
...\Usr\Local\prj\PythonPartsScripts
...\Usr\Local\prj\VisualScripts
...\Usr\Local\prj\Scripts
...\Std\PythonPartsScripts
...\Std\VisualScripts
...\Std\Scripts
...\Usr\Local\PythonPartsScripts
...\Usr\Local\VisualScripts
...\Usr\Local\Scripts
...\Prg

Best!
Bart

Thanks Bart!
That fixed the things with the exception, but now when I try to run the debugger, I only get a "Connection refused". It redirects me to the ...\Etc\PythonParts_VsCode.code-workspace. I can edit the files I have created without any problems, so I do have the right permissions...

1 - 10 (11)