Pyodbc module not being found even when added to sys.path

I’m working on developing an extension to connect a USD scene into an SQL Server Database, but it relies on the pyodbc package to establish a connection to the server.
I’ve installed the package into a folder inside the extension called ‘deps’, but even when I append the file location to sys.path it is being discovered when I try to import it. Any ideas as to why this might be?

The project is arrange as follows:
exts
| - deps
| -------- | pyodbc installed here
| - lm
| ---------| db
| ---------|----------| connector
| ---------|----------|---------| importing package for use here

Here is a screenshot of the import block. The import exception is always caught.
omnidbsnip

Hi @brett.j.amberge. That path would be relative to your current working directory. I would use this snippet to get the root path of your extension and then build a path to your deps folder using that: Get the File Path to an Extension — Omniverse Kit documentation

Thanks for the fast response! Trying this method doesn’t seem to be working either. It does not seem as thought the path to the extension is being added to sys.path properly. Is there some string formatting I’m missing here?

omnidbsnip

I’ve also included a screenshot of the console output in Code.

Looks correct to me. Are you sure that package is correctly set up? Have you tried adding the path in a standalone Python interpret to see if it works?

The package was installed correctly and working in a separate interpreter, but it was installed using Python 3.9. I removed and reinstalled it using Python 3.7 and it works perfectly now. Thanks for the help!

Excellent!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.