You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by is...@apache.org on 2020/05/25 13:57:05 UTC
[airavata] branch develop updated: OS independent path seperators
This is an automated email from the ASF dual-hosted git repository.
isjarana pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/develop by this push:
new 1265b74 OS independent path seperators
new 4fa2a9a Merge pull request #250 from isururanawaka/pythonSDK
1265b74 is described below
commit 1265b74502c43906d6f386382c3cac61a5039d06
Author: Isuru Ranawaka <ir...@gmail.com>
AuthorDate: Mon May 25 09:56:04 2020 -0400
OS independent path seperators
---
.../airavata-python-sdk/clients/sftp_file_handling_client.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/clients/sftp_file_handling_client.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/clients/sftp_file_handling_client.py
index 6db95ea..8c11e25 100644
--- a/airavata-api/airavata-client-sdks/airavata-python-sdk/clients/sftp_file_handling_client.py
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/clients/sftp_file_handling_client.py
@@ -16,6 +16,7 @@
import logging
import pysftp
+import os
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
@@ -38,22 +39,24 @@ class SFTPConnector(object):
self.password = password
def upload_files(self, local_path, project_name, exprement_id):
- remote_path = "/" + project_name + "/" + exprement_id + "/"
+ remote_path = os.path.join('', project_name, exprement_id, '')
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
with pysftp.Connection(host=self.host, port=self.port, username=self.username,
password=self.password, cnopts=cnopts) as sftp:
try:
+ base = os.path.join('', project_name)
+ sftp.mkdir(base)
sftp.mkdir(remote_path)
except OSError:
pass
sftp.put_r(localpath=local_path, remotepath=remote_path, confirm=True, preserve_mtime=False)
sftp.close()
- pathsuffix = "/" + self.username + remote_path
+ pathsuffix = os.path.join('', self.username + remote_path)
return pathsuffix
def download_files(self, local_path, project_name, exprement_id):
- remote_path = "/" + project_name + "/" + exprement_id + "/"
+ remote_path = os.path.join('', project_name, exprement_id, '')
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
with pysftp.Connection(host=self.host, port=self.port, username=self.username,