You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xu...@apache.org on 2020/11/26 03:11:04 UTC

[iotdb] branch fix_python_pip created (now 1952cdb)

This is an automated email from the ASF dual-hosted git repository.

xuekaifeng pushed a change to branch fix_python_pip
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 1952cdb  fix python path

This branch includes the following new commits:

     new 1952cdb  fix python path

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: fix python path

Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xuekaifeng pushed a commit to branch fix_python_pip
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 1952cdb5c0cc44999e5a7ebef8ea6dab010168d6
Author: 151250176 <15...@smail.nju.edu.cn>
AuthorDate: Thu Nov 26 11:10:38 2020 +0800

    fix python path
---
 client-py/src/Session.py               | 21 +++++++++++++++++----
 client-py/src/SessionExample.py        | 17 ++++++++++++-----
 client-py/src/utils/Field.py           |  5 ++++-
 client-py/src/utils/IoTDBRpcDataSet.py | 11 ++++++++++-
 client-py/src/utils/RowRecord.py       |  8 ++++++--
 client-py/src/utils/SessionDataSet.py  | 16 ++++++++++++----
 client-py/src/utils/Tablet.py          |  7 ++++++-
 7 files changed, 67 insertions(+), 18 deletions(-)

diff --git a/client-py/src/Session.py b/client-py/src/Session.py
index 93579ce..1fe8e41 100644
--- a/client-py/src/Session.py
+++ b/client-py/src/Session.py
@@ -23,16 +23,29 @@ import time
 #sys.path.append("../../thrift/target/generated-sources-python")
 sys.path.append("./utils")
 
-from IoTDBConstants import *
-from SessionDataSet import SessionDataSet
+# for package
+from .utils.IoTDBConstants import *
+from .utils.SessionDataSet import SessionDataSet
 
 from thrift.protocol import TBinaryProtocol, TCompactProtocol
 from thrift.transport import TSocket, TTransport
 
-from iotdb.rpc.TSIService import Client, TSCreateTimeseriesReq, TSInsertRecordReq, TSInsertTabletReq, \
+from .iotdb.rpc.TSIService import Client, TSCreateTimeseriesReq, TSInsertRecordReq, TSInsertTabletReq, \
      TSExecuteStatementReq, TSOpenSessionReq, TSQueryDataSet, TSFetchResultsReq, TSCloseOperationReq, \
      TSCreateMultiTimeseriesReq, TSCloseSessionReq, TSInsertTabletsReq, TSInsertRecordsReq
-from iotdb.rpc.ttypes import TSDeleteDataReq, TSProtocolVersion, TSSetTimeZoneReq
+from .iotdb.rpc.ttypes import TSDeleteDataReq, TSProtocolVersion, TSSetTimeZoneReq
+
+# for debug
+# from IoTDBConstants import *
+# from SessionDataSet import SessionDataSet
+#
+# from thrift.protocol import TBinaryProtocol, TCompactProtocol
+# from thrift.transport import TSocket, TTransport
+#
+# from iotdb.rpc.TSIService import Client, TSCreateTimeseriesReq, TSInsertRecordReq, TSInsertTabletReq, \
+#      TSExecuteStatementReq, TSOpenSessionReq, TSQueryDataSet, TSFetchResultsReq, TSCloseOperationReq, \
+#      TSCreateMultiTimeseriesReq, TSCloseSessionReq, TSInsertTabletsReq, TSInsertRecordsReq
+# from iotdb.rpc.ttypes import TSDeleteDataReq, TSProtocolVersion, TSSetTimeZoneReq
 
 
 class Session(object):
diff --git a/client-py/src/SessionExample.py b/client-py/src/SessionExample.py
index 5ad0882..35e57bd 100644
--- a/client-py/src/SessionExample.py
+++ b/client-py/src/SessionExample.py
@@ -18,11 +18,18 @@
 
 import sys
 # Uncomment the following line to use apache-iotdb module installed by pip3
-#import iotdb
-sys.path.append("./utils")
-from IoTDBConstants import *
-from Tablet import Tablet
-from Session import Session
+
+# for debug
+# sys.path.append("./utils")
+# from IoTDBConstants import *
+# from Tablet import Tablet
+# from Session import Session
+
+# for package
+from iotdb_session.utils.IoTDBConstants import *
+from iotdb_session.utils.Tablet import Tablet
+from iotdb_session.Session import Session
+
 
 # creating session connection.
 ip = "127.0.0.1"
diff --git a/client-py/src/utils/Field.py b/client-py/src/utils/Field.py
index 7b5fea5..55d1e33 100644
--- a/client-py/src/utils/Field.py
+++ b/client-py/src/utils/Field.py
@@ -16,8 +16,11 @@
 # under the License.
 #
 
-from IoTDBConstants import TSDataType
+# for package
+from .IoTDBConstants import TSDataType
 
+# for debug
+# from IoTDBConstants import TSDataType
 
 class Field(object):
 
diff --git a/client-py/src/utils/IoTDBRpcDataSet.py b/client-py/src/utils/IoTDBRpcDataSet.py
index f712c98..6aa2fa3 100644
--- a/client-py/src/utils/IoTDBRpcDataSet.py
+++ b/client-py/src/utils/IoTDBRpcDataSet.py
@@ -16,7 +16,16 @@
 # under the License.
 #
 
-from IoTDBConstants import *
+# for package
+from .IoTDBConstants import *
+
+# for debug
+# from IoTDBConstants import *
+
+import sys
+from os.path import dirname, abspath
+path = dirname(dirname(abspath(__file__)))
+sys.path.append(path)
 
 from thrift.transport import TTransport
 from iotdb.rpc.TSIService import TSFetchResultsReq, TSCloseOperationReq
diff --git a/client-py/src/utils/RowRecord.py b/client-py/src/utils/RowRecord.py
index 78e0362..46d810e 100644
--- a/client-py/src/utils/RowRecord.py
+++ b/client-py/src/utils/RowRecord.py
@@ -16,9 +16,13 @@
 # under the License.
 #
 
-from IoTDBConstants import TSDataType
-from Field import Field
+# for package
+from .IoTDBConstants import TSDataType
+from .Field import Field
 
+# for debug
+# from IoTDBConstants import TSDataType
+# from Field import Field
 
 class RowRecord(object):
 
diff --git a/client-py/src/utils/SessionDataSet.py b/client-py/src/utils/SessionDataSet.py
index 92662cc..91b1989 100644
--- a/client-py/src/utils/SessionDataSet.py
+++ b/client-py/src/utils/SessionDataSet.py
@@ -16,10 +16,18 @@
 # under the License.
 #
 
-from IoTDBConstants import TSDataType
-from IoTDBRpcDataSet import IoTDBRpcDataSet
-from Field import Field
-from RowRecord import RowRecord
+# for package
+from .IoTDBConstants import TSDataType
+from .IoTDBRpcDataSet import IoTDBRpcDataSet
+from .Field import Field
+from .RowRecord import RowRecord
+
+# for debug
+# from IoTDBConstants import TSDataType
+# from IoTDBRpcDataSet import IoTDBRpcDataSet
+# from Field import Field
+# from RowRecord import RowRecord
+
 import struct
 
 
diff --git a/client-py/src/utils/Tablet.py b/client-py/src/utils/Tablet.py
index 51798a4..cdb0c21 100644
--- a/client-py/src/utils/Tablet.py
+++ b/client-py/src/utils/Tablet.py
@@ -16,7 +16,12 @@
 # under the License.
 #
 
-from IoTDBConstants import *
+# for package
+from .IoTDBConstants import *
+
+# for debug
+# from IoTDBConstants import *
+
 import struct