compas icon indicating copy to clipboard operation
compas copied to clipboard

Incorrect detection of Rhino

Open AdamAnouar opened this issue 3 years ago • 2 comments

Describe the bug If Rhino-stubs are installed on the cpython environment, compas will incorrectly assume that it is inside Rhino (compas.RHINO == True)

To reproduce:

  • Install Rhino-stubs in an environment
  • Start python and run from compas.geometry import Box

AdamAnouar avatar Oct 27 '22 11:10 AdamAnouar

Rhino-stubs wouldn't let me import Rhino. After installing rhinoinside I can import Rhino but only after calling rhinoinside.load(). In that context, COMPAS is not entirely wrong as there is really an instance of Rhino available. What's missing are indeed rhinoscriptsyntax and scriptcontext which might cause certain things to break later on.

But maybe we could test more accurately with Rhino.__file__:

# in Rhino/GH
>import Rhino
>Rhino.__file__
RhinoCommon, Version=7.22.22255.5001, Culture=neutral, PublicKeyToken=552281e97c755530, Rhino.UI, Version=7.22.22255.5001, Culture=neutral, PublicKeyToken=552281e97c755530
# in CPython with rhinoinside
>import Rhino
>Rhino.__file__
'C:\\Program Files\\Rhino 7\\System\\RhinoCommon.dll'

chenkasirer avatar Oct 27 '22 13:10 chenkasirer

Ok, this needs to be investigated further. When i tested on @AdamAnouar computer, Rhino.__file__ was empty but Rhino.__path__ was pointing to the site packages.

gonzalocasas avatar Oct 27 '22 14:10 gonzalocasas