Hello.
As a developper in a company with multiple repositories, we often work with multiple python environments, which we generally manage through poetry.
We are able to set specific python environments by modifying the userset.txt file (defaultPython). However, this modification is not practical if we have to run Coppelia on multiple environments or in newly created ones (for example, those created under a CI/CD routine).
I've found that the defaultPython variable is read and saved as an App Property. However, based on documentation, this app property is not writable. So I understand that it is not possible to change it once Coppelia has been started.
Let's imagine, for example, that I am launching Coppelia from a python script. Is there a way to dynamically change this variable that doesn't involve writting the usrtset.txt file before launching Coppelia?
Cheers!
Can I change defaultPython dynamically?
Re: Can I change defaultPython dynamically?
Hello,
not sure I understood you correctly, but you can set the Python executable for every simulation script you wanna launch with something like:
You can also dynamically do this with something like:
And adjust the value of that string signal somewhere else with:
Cheers
not sure I understood you correctly, but you can set the Python executable for every simulation script you wanna launch with something like:
Code: Select all
#python
#luaExec pythonExecutable = 'c:/python38/python.exe'
# Here your Python code
Code: Select all
#python
#luaExec pythonExecutable = sim.getStringProperty(sim.handle_app, 'signal.pythonExec')
Code: Select all
sim.setStringProperty(sim.handle_app, 'signal.pythonExec', 'c:/python38/python.exe')
Re: Can I change defaultPython dynamically?
Thank you so much.
I will try this but it looks good to me.
Cheers!
I will try this but it looks good to me.
Cheers!