2

When i try to run the samples/robotbenchmark/squar_path example I first got the message:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of Webots will drop support for Python 2.7.
[square_path_supervisor] DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of Webots will drop support for Python 2.7.

While a Python 3.7 version

python --version
Python 3.7.4

is available via my Macports environment

port version
Version: 2.5.4

So I think that Webots doesn't use the settings from my macports profile - how could i achive this? I tried setting the python path to

/opt/local/bin/python

in preferenes/general but then I ended up with a complaint:

ImportError: dlopen(/Applications/Webots.app/lib/python37/_controller.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python

And I have not seen an option to specify the library path ...

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
  • see https://discordapp.com/channels/595546443498913822/595546443498913824 – Wolfgang Fahl Aug 21 '19 at 16:31
  • Just note that Webots comes with Python libraries precompiled with the official Python which can be downloaded on the official website, but not the macport or brew one. It would be safer to install Python the same way: https://cyberbotics.com/doc/guide/using-python – FabienRohrer Aug 22 '19 at 07:01

2 Answers2

2

The library path is not recognized /Library/Frameworks/Python.framework/Versions/3.7/Python does not exist but the /opt/local//Library/Frameworks/Python.framework/Versions/3.7/Python one does ..

So as a workaround in /Library/Frameworks i did a

sudo ln -s /opt/local/Library/Frameworks/Python.framework . 

Now the robot starts...

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
2

You can easily specify globally the version of python that Webots should use in the Webots preferences. You can open the preferences from the 'Tools / Preferences' menu:

enter image description here

Then you simply have to change the 'Python command' preference:

https://cyberbotics.com/doc/guide/preferences#general

David Mansolino
  • 1,713
  • 7
  • 13
  • This is a good first step as mentioned in my question. It probably works well for non Macports- environments. The followup problem of the Library path resolution for Macports is not solved this way though. – Wolfgang Fahl Aug 22 '19 at 07:54
  • You're indeed right, this allows to specify the version of Webots used, but does not solve the macports issue. – David Mansolino Aug 23 '19 at 08:07