User bio

18+ experience with InterSystems products, in different sizes of projects, different countries, and different fields except for healthcare.

Melbourne, VIC, Australia
Member since Dec 4, 2015
Pinned posts:
USER>:py Python 3.12.3 (main, Feb  4 2025, 14:48:35) [GCC 13.3.0] on linux
Type quit() or Ctrl-D to exit this shell.
>>> import sys
>>> sys.path
['/usr/irissys/mgr/python', '/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload', '/usr/local/lib/python3.12/dist-packages', '/usr/lib/python3/dist-packages', '/usr/irissys/mgr/python', '/usr/irissys/lib/python', '/usr/local/lib/python3.12/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.12/dist-packages']
>>>

did you try /usr/irissys/mgr/python, that's the path expected to be used by IRIS packages

pip install whatever --target /usr/irissys/mgr/python

and another place is /usr/irissys/lib/python, it's a place where InterSystems places Python Embedded support

sys.path, is a list of folders where python will look for the installed modules

Did you try using more appropriate package %Stream for it?

In your case, you would need to use %Stream.FileCharacter

 Set stream=##class(%Stream.FileCharacter).%New()
 $$$ThrowOnError(stream.LinkToFile("c:\export.csv"))
 set rs = ##class(%SQL.Statement).%ExecDirect(, "SELECT a, b FROM table")
 if rs.%SQLCODE'=0 {
     throw ##class(%Exception.SQL).CreateFromSQLCODE(rs.%SQLCODE, rs.%Message)
 }
 while rs.%Next() {
    set line = $listbuild(rs.a, rs.b)
    do f.WriteLine($listtostring(line, ","))
 }
 $$$ThrowOnError(stream.%Save())

Additionally, nowadays using embedded classes does not give much advantage, if it's not for one row result, only makes the code a bit harder to read

Open Exchange applications:
Certifications & Credly badges:
Global Masters badges:
Followers:
Following:
Dmitry has not followed anybody yet.