@@ -147,11 +147,11 @@ def _download_dir(self, remotepath, localpath, overwrite=True):
147
147
i += 1
148
148
logger .info ("Directory %s downloaded. %s files copied" , localpath , i )
149
149
150
- def open_file (self , remote_file , open_options = "r" ):
151
- return self .client .root .open (remote_file , open_options = open_options )
150
+ def open_file (self , remote_file , open_options = "r" , encoding = None ):
151
+ return self .client .root .open (remote_file , open_options = open_options , encoding = encoding )
152
152
153
- def create_file (self , remote_file , create_options = "w" ):
154
- return self .client .root .open (remote_file , open_options = create_options )
153
+ def create_file (self , remote_file , create_options = "w" , encoding = None , override = True ):
154
+ return self .client .root .create (remote_file , open_options = create_options , encoding = encoding , override = override )
155
155
156
156
def makedirs (self , remotepath ):
157
157
if self .client .root .pathexists (remotepath ):
@@ -1029,15 +1029,15 @@ def edb(edbpath=None,
1029
1029
use_ppe = use_ppe , )
1030
1030
1031
1031
@staticmethod
1032
- def exposed_open (filename , open_options = "rb" ):
1033
- f = open (filename , open_options )
1032
+ def exposed_open (filename , open_options = "rb" , encoding = None ):
1033
+ f = open (filename , open_options , encoding = encoding )
1034
1034
return rpyc .restricted (f , ["read" , "readlines" , "close" ], [])
1035
1035
1036
1036
@staticmethod
1037
- def exposed_create (filename ,create_options = "wb" ):
1038
- if os .path .exists (filename ):
1037
+ def exposed_create (filename ,create_options = "wb" , encoding = None , override = True ):
1038
+ if os .path .exists (filename ) and not override :
1039
1039
return "File already exists"
1040
- f = open (filename , create_options )
1040
+ f = open (filename , create_options , encoding = encoding )
1041
1041
return rpyc .restricted (f , ["read" , "readlines" , "write" , "writelines" , "close" ], [])
1042
1042
1043
1043
@staticmethod
0 commit comments