Based on the answer to Referencing Qt UIs external to plugin with python. I'm trying to utilize the "Layer Properties / Fields / Python Init function" to execute a file (test_file.py) that is located in the folder of the plugin that I'm making.
I've made sure that the path to my plugin folder is in PYTHONPATH via "Settings / Options... / System / Environment" ... and restarted QGIS.
When the layer, for which I'm utilizing Init function, is initialized and a feature is selected test.py is executed. However, I get three consecutive error messages saying:
1) An error occured during execution of following code: import test_file Traceback (most recent call last): File "", line 1, in File "C:/PROGRA~1/QGISVA~1/apps/qgis/./python\qgis\utils.py", line 453, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ImportError: No module named test_file2) An error occured during execution of following code: if hasattr(test_file,'DEBUGMODE') and test_file.DEBUGMODE: reload(test_file) Traceback (most recent call last): File "", line 1, in NameError: name 'test_file' is not defined3) An error occured during execution of following code: _qgis_feature_form_20140526104937007 = test_file.py(_qgis_featureform_2, _qgis_layer_workgroups20140526104723778, _qgis_feature_20140526104937007) Traceback (most recent call last): File "", line 1, in NameError: name 'test_file' is not definedAny suggestions how to fix this?
أكثر...
I've made sure that the path to my plugin folder is in PYTHONPATH via "Settings / Options... / System / Environment" ... and restarted QGIS.
When the layer, for which I'm utilizing Init function, is initialized and a feature is selected test.py is executed. However, I get three consecutive error messages saying:
1) An error occured during execution of following code: import test_file Traceback (most recent call last): File "", line 1, in File "C:/PROGRA~1/QGISVA~1/apps/qgis/./python\qgis\utils.py", line 453, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ImportError: No module named test_file2) An error occured during execution of following code: if hasattr(test_file,'DEBUGMODE') and test_file.DEBUGMODE: reload(test_file) Traceback (most recent call last): File "", line 1, in NameError: name 'test_file' is not defined3) An error occured during execution of following code: _qgis_feature_form_20140526104937007 = test_file.py(_qgis_featureform_2, _qgis_layer_workgroups20140526104723778, _qgis_feature_20140526104937007) Traceback (most recent call last): File "", line 1, in NameError: name 'test_file' is not definedAny suggestions how to fix this?
أكثر...