In want create a new Macro in python. Some stuff works...
sample "import urllib, os, sys, re, getopt, select, xml.dom.minidom, gettext, komodo" work.
But when i want import other module (dbus or pydcop) then make Komodo a error.
ImportError: No module named dbus
In a python shell work import dbus.
In Komdo self works the Modul dbus but why not in a Macro?
What can i do?
These are two different Python installations.
Komodo has it's own separate Python installation that it is using for the Komodo runtime (which includes the macros feature) which will contain different modules to your locally installed Python (i.e. the Python shell).
Komodo's Python installation only includes the standard Python library modules.
Cheers,
Todd
Hello,
Any advised way to work around this? I wanted to use Trent Mick's python-markdown2 in a macro (my python macro, yay), and spent an hour trying to figure out why the module wouldn't import.
Now i've "fixed" it by copying the markdown2.py file with the libs in Komodo's Python installation on my computer. That's kinda dirty/hackish/whatever. What would be best?
For a macro, you'll need to adjust Komodo's sys.path to include the path to the markdown2 directory:
import markdown2
sys.path.append("/path/to/markdown_parent") import markdown2Note: Komodo extensions work a little differently, in that they can have a specific "pylib" directory that is automatically added to Komodo's Python sys.path.
Cheers,
Todd