1

I am a newbie in Python and I am trying to use Ironpython with PTVS to access a Postgres database. I had previously installed Python(x,y) and psycopg2 which I managed to use properly. However, realizing how painful it is (imo) to create GUIs with TKinter I decided to move to Ironpython and PTVS cause WPF GUIs are much easier (and I don't need to port the scripts to other systems).

After installing PTVS and ironpython, I therefore created a project in Visual Studio and added to the "search paths" section the path to the psycopg2 package (within the install of Python(x,y)'s interpreter). I then tried a simple hello world with an import of psycopg2 but I am getting an error during the import.

My code:

import psycopg2
print "hello world"

The error I am getting:

    An Exception of type 'IronPython.Runtime.Exceptions.ImportException' occured in Snippets.debug.scripting but was not handled in user code
Additional information: cannot import _psycopg from psycopg2

I have read somewhere that I am meant to create a virtual environment with psycopg2 in it, but I am not understanding how to do this.

If someone could help me to figure this one out, that would be awesome.

Thanks heaps

Rejerh
  • 33
  • 6

0 Answers0