Back to Blog
Connect postgres to python text editor6/29/2023 ![]() ![]() Then run the script, and again an error : Traceback (most recent call last):įile "/usr/local/lib/python3.1/dist-packages/postgresql/_init_.py", line 65, in openįile "/usr/local/lib/python3.1/dist-packages/postgresql/iri.py", line 177, in parseįile "/usr/local/lib/python3.1/dist-packages/postgresql/iri. > ('/usr/local/lib/python3.1/dist-packages') ![]() Open Blender, go to consol editor : > import sys What I do next is to add system python path to blender : The I try the script again and there is a new error : Traceback (most recent call last):įile "Text.001", line 2, in įile "/opt/blender25/.blender/python/lib/python3.1/dist-packages/postgresql/_init_.py", line 57, in openįile "/opt/blender25/.blender/python/lib/python3.1/dist-packages/driver/_init_.py", line 9, in įile "/opt/blender25/.blender/python/lib/python3.1/dist-packages/driver/pq3.py", line 20, inSo what I try first is to copy postgresql for /usr/local/lib/python3.1/dist-packages/postgresql to /opt/blender25/.blender/python/lib/python3.1/dist-packages. So that in this tutorial, we will discuss how to connect to PostgreSQL using psycopg2. However, psycopg2 becomes the most popular one. Logical because blender use a build in python version. In Python, we have several modules to connect to PostgreSQL such as SQLAlchemy, pg8000, py-postgresql, etc. So then, I open Blender > text editor, and run the script from it. Ps = db.prepare ("INSERT INTO test_table (id, name) VALUES (2, 'guigui')") py file : import postgresqlÄb = postgresql.open("qp://postgres: /testdb") Iâve installed py-postgresql (python3 compatible). I need to connect a PostGreSQL database from Blender2.5.
0 Comments
Read More
Leave a Reply. |