소스 검색

auto commit

master
jfinn 2 년 전
부모
커밋
188248c5e1
1개의 변경된 파일29개의 추가작업 그리고 1개의 파일을 삭제
  1. 29
    1
      wsps/tasks_loop.py

+ 29
- 1
wsps/tasks_loop.py 파일 보기

@@ -199,6 +199,9 @@ class globCL():
199 199
 class RldMan():
200 200
 	def __init__(self,*a,**kw):
201 201
 		self.files = {}
202
+		self.print_tb = 0
203
+		self.dflt_scope = {"globals":globals(),"locals":locals()}
204
+		self.dflt_scope2 = {"globals":copy.copy(globals()),"locals":copy.copy(locals())}
202 205
 
203 206
 		base_path = "/usr/games/repos/ign4/py_rld/djc/rdir1/"
204 207
 
@@ -221,7 +224,32 @@ class RldMan():
221 224
 				p("add files???",file)
222 225
 	def add_file(self,file_name,fnx={}):
223 226
 		self.files[file_name] = {"ftxt":"",**fnx}
224
-	def rld_file(self,*a,**kw):pass
227
+	def rld_file(self,file_name,ret= {"errs":{},"all":{},"alle":{},},**kw):
228
+		if file_name in self.files:
229
+			rfile_obj = self.files[file_name]
230
+			st = os.stat(file_name)
231
+			st_tuple = (st.st_mtime,st.st_size)
232
+			if rfile_obj["ftxt"] != st_tuple:
233
+				rfile_obj["ftxt"] = st_tuple
234
+				try:
235
+					f = open(file_name,"r")
236
+					ftxt = f.read()
237
+					f.close()
238
+					exec(ftxt)
239
+
240
+				except Exception as e:
241
+					print("EXCEPT",eflag,e)
242
+					if self.print_tb:
243
+						traceback.print_tb(e.__traceback__,file=sys.stdout)
244
+				else:
245
+					pass
246
+					# print("ELSE")
247
+				finally:
248
+					# print("FINALLY")
249
+					pass
250
+				print(end="",flush=True)
251
+		return ret
252
+
225 253
 	def rld_files(self):
226 254
 		# p()
227 255
 

Loading…
취소
저장