How can I*create a QGIS plugin that needs an external Python library?

المشرف العام

Administrator
طاقم الإدارة
I’m trying to enhance QGIS's Profiletool plugin by adding DXF export functionnality. For this, I need to to import dxfwrite library. As it's installed on my computer, i added the following lines to plugin code:

import sys sys.path.append("C:\Python27\Lib\site-packages") With those short lines of code, I'm able to load dxfwrite. But it's hardcoded, so if the user does not have Python 2.7 but 3.4 (for example), library loading will probably fail because plugin will try to load dxfwrite from a non-existing repository. The same problem may happen if python path is not C:\Python27\....

I tried to put dxfwrite sources into plugin directory, but 1) with no results, 2) if results, it would link plugin to a specific version of dxfwrite and 3) if results, it would increase a lot plugin size.

So, how can I properly load dxfwrite without facing those problems*?

Thanks a lot,

J.



أكثر...
 
أعلى