44import warnings
55
66from ._utils import get_string , dss_py
7+ from . import _utils
78
89is_pandas_installed = True
910
@@ -23,12 +24,12 @@ def __init__(self, module, function):
2324
2425 def __iter__ (self ):
2526 import opendssdirect as dss
26-
27+
2728 try :
2829 idx = self .module .First ()
2930 except :
3031 return # no circuit?
31-
32+
3233 if dss .Error .ExtendedErrors () and idx == 0 :
3334 return # nothing to iterate
3435
@@ -47,7 +48,7 @@ def run_command(text, dss=None):
4748
4849 r = []
4950 for l in text .splitlines ():
50- dss .dss_lib .Text_Set_Command (l .encode ("ascii" ))
51+ dss .dss_lib .Text_Set_Command (l .encode (_utils . codec ))
5152 r .append (get_string (dss .dss_lib .Text_Get_Result ()))
5253
5354 return "\n " .join (r ).strip ()
@@ -245,9 +246,9 @@ def monitor_to_dataframe(dss=None):
245246 if dss .Solution .Mode () in (dss_py .enums .SolveModes .Harmonic , 17 ):
246247 # Note: Mode 17 is HarmonicT but it was not exposed in the enum
247248 # ported from COM as of 2021-01-03
248- columns = ['frequency' , 'harmonic' ]
249+ columns = ['frequency' , 'harmonic' ]
249250 else :
250- columns = ['hour' , 'second' ]
251+ columns = ['hour' , 'second' ]
251252
252253 columns .extend (col .strip () for col in dss .Monitors .Header ())
253254 data = dss .Monitors .AsMatrix ()
0 commit comments