Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## [5.108.4] - 2026-07-15

### Added

- `Enhancement` Add debug logging to IOM.submit method to help solve issue.

### Changed

- `None` Nothing Changed

### Fixed

- `Bug Fix` Make sure we don't attempt to use an index that is out of range when processing IOM.submit loglines parameter

### Removed

- `None` Nothing removed

## [5.108.3] - 2026-07-08

### Added
Expand Down
5 changes: 5 additions & 0 deletions saspy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
logger.setLevel(logging.INFO)
logger.propagate=False

IOMLogger = logging.getLogger("IOMLogger")
IOMLogger.addHandler(logging.StreamHandler(sys.stdout))
IOMLogger.setLevel(logging.INFO)
IOMLogger.propagate=False

def _isnotebook():
try:
shell = get_ipython().__class__.__name__
Expand Down
28 changes: 27 additions & 1 deletion saspy/sasioiom.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
import io
import atexit
import re
#import debugpy
#debugpy.listen(5678)
#print("Waiting for debugger attach")
#debugpy.wait_for_client()
#debugpy.breakpoint()

import logging
logger = logging.getLogger('saspy')
Expand Down Expand Up @@ -1089,6 +1094,7 @@ def submit(self, code: str, results: str ="html", prompt: dict = None, **kwargs)
lstf.replace(chr(12), chr(10)).replace('<body class="c body">',
'<body class="l body">').replace("font-size: x-small;",
"font-size: normal;")

logf = logf.decode(errors='replace').replace(chr(12), chr(20))
self._log += logf
final = logf.partition(logcodei)
Expand All @@ -1098,6 +1104,16 @@ def submit(self, code: str, results: str ="html", prompt: dict = None, **kwargs)
zz = z[0].rpartition("\nE3969440A681A24088859985" + prev +'\n')
logd = zz[2].replace(mj.decode(), '')

IOMLogger = logging.getLogger("IOMLogger")
IOMLogger.debug("DEBUG raw log start ->\n{0}\n<- DEBUG - raw log end\n".format(logf))
#IOMLogger.debug("DEBUG - final={0}\n".format(final))
#IOMLogger.debug("DEBUG - types={0}\n".format(types))
#IOMLogger.debug("DEBUG - z={0}\n".format(z))
#IOMLogger.debug("DEBUG - prev={0}\n".format(prev))
#IOMLogger.debug("DEBUG - zz={0}\n".format(zz))
IOMLogger.debug("DEBUG - clean log start ->\n{0}\n<- DEBUG - clean log end\n".format(logd))
IOMLogger.debug("DEBUG - clean lst start ->\n{0}\n<- DEBUG - clean lst end\n".format(lstd))

if re.search(r'\nERROR[ \d-]*:', logd):
warnings.warn("Noticed 'ERROR:' in LOG, you ought to take a look and see if there was a problem")
self._sb.check_error_log = True
Expand All @@ -1115,10 +1131,20 @@ def submit(self, code: str, results: str ="html", prompt: dict = None, **kwargs)
sas_linetype_mapping
types = types.partition(b"TomSaysTypes=")[2]
types = list(types.rpartition(logcodeo)[0].decode(errors='replace'))
IOMLogger.debug("DEBUG - processing 'lines' - types={0}\n".format(types))

logl = []
logs = logd.split('\n')
for i in range(len(logs)):

l_logs = len(logs)
l_types = len(types)
maxlines=l_logs if l_logs <= l_types else l_types

IOMLogger.debug("DEBUG - processing 'lines' - l_logs={0}".format(l_logs))
IOMLogger.debug("DEBUG - processing 'lines' - l_types={0}".format(l_types))
IOMLogger.debug("DEBUG - processing 'lines' - maxlines={0}".format(maxlines))

for i in range(maxlines):
logl.append({'line':logs[i], 'type':sas_linetype_mapping[int(types[i])]})
logd = logl

Expand Down
2 changes: 1 addition & 1 deletion saspy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '5.108.3'
__version__ = '5.108.4'
Loading