Support Forum

Python package reloading issue [Gelöst]

Schlagworte:
  • [AIDP-244165]

Hello,

In my PythonPart i'm trying to use a additional python package which also includes numpy. When i try to run the script i get the following error: 'Reloading numpy._globals is not allowed', see also the image below.

Is there a way to get around this issue?

Thank you in advance.

Frenk

Anhänge (1)

Typ: image/png
49-mal heruntergeladen
Größe: 29,43 KiB

Lösung anzeigen Lösung verbergen

Hi Frenk,

the problem is the reloader, which we use to reload python modules every time you start a PythonPart in Allplan. Otherwise, you would have to restart Allplan every time you do a small change in the code of your PythonPart.

The reloader also goes through the packages installed in etc\PythonParts-site-packages, which causes problems with some of them (numpy for example). Here's what you can do (choose one way):

  • move numpy to
    Prg\Python\lib\site-packages\
    This is the directory with all the site-packages, that are delivered with Allplan.
  • add numpy to reloader blacklist of modules, it should not consider. The blacklist is defined as a global variable _BLACKLIST in the
    Prg\Python\lib\site-packages\reloader.py


Both actions requires administrative rights and are just workarounds. We will make reloader not to look-up inside this directory anymore.

Let me know, if that helped.
Best,
Bart

Hi Frenk,

the problem is the reloader, which we use to reload python modules every time you start a PythonPart in Allplan. Otherwise, you would have to restart Allplan every time you do a small change in the code of your PythonPart.

The reloader also goes through the packages installed in etc\PythonParts-site-packages, which causes problems with some of them (numpy for example). Here's what you can do (choose one way):

  • move numpy to
    Prg\Python\lib\site-packages\
    This is the directory with all the site-packages, that are delivered with Allplan.
  • add numpy to reloader blacklist of modules, it should not consider. The blacklist is defined as a global variable _BLACKLIST in the
    Prg\Python\lib\site-packages\reloader.py


Both actions requires administrative rights and are just workarounds. We will make reloader not to look-up inside this directory anymore.

Let me know, if that helped.
Best,
Bart

Hi Bart,

A bit late, but thanks for your reply it solved my issue. It took some time convincing our IT-department to give me some admin rights, because it is against our company policy. So ideally in the future from our side it would be preferable to have the reloader not to look-up inside this directory.
Best,
Frenk