It does actually work fine from within DrawBot itself. I have been using this since the end of Jan and haven't had an issue.
Maarten Idema
@Maarten Idema
Best posts made by Maarten Idema
Latest posts made by Maarten Idema
-
RE: Using a virtualenv in Drawbot
-
RE: Using a virtualenv in Drawbot
Thanks for that @justvanrossum. I am using the Python modules todoist, requests, and urllib3 to visualise my todo list in Drawbot.
After reading this I kind of resolved to manually downloading each module and have them sit in the same folder as my Drawbot script. This is so tedious especially for updating modules.
But then I realised that I could still set up my virtualenv, pip install my modules, their dependencies and then in my Drawbot script include the path to the site-packages.
import sys sys.path.insert(0, "/Users/maartenidema/t_venv/lib/python3.6/site-packages")
On a quick initial test, this seems to work. I wonder if there will be module conflicts with Python versions going forward.
-
Using a virtualenv in Drawbot
I often set up a different virtual environment for different Python-based scripting ideas that I run in the terminal. I will do this using virtualenv and pip install the needed modules.
So my question is can I select a Python virtualenv from within the Drawbot app or a script that I'm running in Drawbot?
I have tried adding a shebang at the top of the script pointing to the virtualenv's python. I have also tried something like this:
activate_this_file = "/Users/maartenidema/Desktop/t_venv/bin/activate_this.py" execfile(activate_this_file, dict(__file__=activate_this_file))
I feel like I am really overlooking something quite simple.