Is import of external absolute python module working with python-nautilus 1.2.3-5?

Hello,

I’m currently trying to leverage python capabilities to integrate third party python module to nautilus.

I’m currently doing so:

import os, gettext, importlib.util
from gi.repository import Nautilus, Gtk, GObject, Gio, GLib
from io import StringIO
import sys, contextlib, io
from contextlib import redirect_stdout


spec = importlib.util.spec_from_file_location('odrive', '/home/caz/.local/share/nautilus-python/odrive.py')
odrive_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(odrive_module)
odrive_module.DoSomething()
...

But when loading nautilus using debug it just stops without any error, displaying the following:

_MESSAGES_DEBUG="all" NAUTILUS_DEBUG="Window" nautilus
(org.gnome.Nautilus:34850): GLib-GIO-DEBUG: 13:31:50.004: _g_io_module_get_default: Found default implementation gvfs (GDaemonVfs) for ?gio-vfs?
(org.gnome.Nautilus:34850): Tracker-DEBUG: 13:31:50.018: Loading ontologies from database.
(org.gnome.Nautilus:34850): Tracker-DEBUG: 13:31:50.019: Applying ontologies from /usr/share/nautilus/ontology to existing database
(org.gnome.Nautilus:34850): Tracker-DEBUG: 13:31:50.020: Current and DB locales match: 'C'
(org.gnome.Nautilus:34850): Tracker-DEBUG: 13:31:50.088: Cleaning up stale resource URIs

Am I able to load module the way I do? If not, what would be preferred option? (Please not I cannot add the module to py file, that’s why I try to load it from original source).

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.