go to post Eduard Lebedyuk · Mar 6, 2023 I guess you need to flush the buffer so only python writes? Something like this should work: Class Python.App.Dispatch Extends %CSP.REST { XData UrlMap [ XMLNamespace = "https://www.intersystems.com/urlmap" ] { <Routes> <Route Url="/test" Method="GET" Call="Wrapper" /> </Routes> } ClassMethod Wrapper() { write *-3 do ..Hello() q $$$OK } ClassMethod Hello() [ Language = python ] { import iris print('Hello World') } } Calling @Bob Kuszewski
go to post Eduard Lebedyuk · Mar 3, 2023 62 s a=$zcvt(a,"U") for i=1:1:90{return:$l(a,$c(i))>2 0} q 1
go to post Eduard Lebedyuk · Mar 2, 2023 Oh, right. You're on Ensemble 2014.1. I highly recommend updating to the latest Ensemble version or even better migrating to InterSystems IRIS.
go to post Eduard Lebedyuk · Mar 2, 2023 Last line: S obj={}.%FromJSON(Httprequest.HttpResponse.Data)
go to post Eduard Lebedyuk · Mar 2, 2023 Easiest way would be to add %JSON.Adapter and use JSON for interop.
go to post Eduard Lebedyuk · Feb 28, 2023 Awesome! About label+offset^routine. How would recent Improvements to how IRIS classes are generated and called would affect error messages from class methods? Pinging @Mark Hanson.
go to post Eduard Lebedyuk · Feb 23, 2023 Great! Does it work through default Publish/Subscribe interoperability hosts? Or is it something custom? If custom, any reason why?
go to post Eduard Lebedyuk · Feb 22, 2023 do $zf(-100, "/SHELL", "echo", $zcvt("test тест", "O", "UTF8")) test тест
go to post Eduard Lebedyuk · Feb 16, 2023 Yes, that'll work. Just need to be careful to export everything. Classes? Routines? Custom Schemas? LUTs? SDS?
go to post Eduard Lebedyuk · Feb 16, 2023 I usually follow these steps when I have two similar but distinct codebases: Create a new repo. Export everything from the LIVE server into the repo. Commit. Export everything from the TEST server into the repo. Commit. Commit from step (3) would have all the differences between LIVE and TEST. I assume the code on TEST is newer, so that should be a later commit, but it you want to, you can swap the export order. Before making a commit (3) you might want to remove trivial differences such as whitespaces, etc. Also Gitlab has a compare mode for commits which automatically ignores whitespace differences.
go to post Eduard Lebedyuk · Feb 10, 2023 1. Try running: cd <IRIS>\bin ./irispython "C:\InterSystems\IRIS\lib\python\Scripts\pywin32_postinstall.py" -install It might fix your error. If that does not help, add win32 folder to path explitictly and try import again: import sys sys.path.append("<IRIS>\Mgr\python\win32") import win32api
go to post Eduard Lebedyuk · Feb 9, 2023 While testing, I see I can easily set %session.Data to hold data I want to preserve. No problem! I thought you were having issues with that part. how, on my next API call can I use that session You just need to supply the cookies CSPSESSIONID and CSPWSERVERID. With that you'll have the same session. In browsers (and I think in postman) that's automatic, so you don't have to do anything. It should work out of the box as long as you have UseSession set to 1.
go to post Eduard Lebedyuk · Feb 8, 2023 From the documentation (even better docs): 1. Open the spec class. 2. Add Parameter UseSession As BOOLEAN = 1; 3. Recompile the spec class. 4. Now your disp class has the same parameter and you can use sessions in your impl class. If you need a larger change than adding a parameter to a dispatcher class, do this (docs): 1. Create a custom subclass of %CSP.REST, i.e. test.REST.2. Modify your swagger spec by adding x-ISC_DispatchParent: "info":{ "version":"1.0.0", "x-ISC_DispatchParent":"test.REST", 3. Recompile. Now your disp class extends test.REST and you can modify anything there.
go to post Eduard Lebedyuk · Feb 8, 2023 Can you provide a minimal disp/impl/spec classes example please?
go to post Eduard Lebedyuk · Feb 6, 2023 Pythonic way is to use with. In that case close is automatic as soon as we get outsude of the context: ClassMethod ReadFileUsingPython(pFile As %String) [ Language = python ] { from datetime import datetime import iris time1 = datetime.timestamp(datetime.now()) print(time1) if pFile=="": raise Exception("filename is required.") with open(pFile,"r", encoding="utf-8", errors="ignore") as file: log = iris.cls('otw.log.Log') for line in file: status = log.ImportLine(line) time2 = datetime.timestamp(datetime.now()) print(time2) print("Execution time: ",(time2-time1)) }