Home Download Buy Blog Forum Support

[solved]ValueError: Attempted relative import in non-package

[solved]ValueError: Attempted relative import in non-package

Postby desperado70 on Tue Apr 23, 2013 9:03 am

I have the plugin OpenRelated (https://github.com/vojtajina/sublime-OpenRelated) installed in Sublime 2.0.1. Worked nicely untill somewhere last week.
When looking in the console, now I get the following error

Reloading plugin C:\Users\...\AppData\Roaming\Sublime Text 2\Packages\Open Related\open_related.py
Traceback (most recent call last):
File ".\sublime_plugin.py", line 62, in reload_plugin
File ".\open_related.py", line 3, in <module>
from . import converter
ValueError: Attempted relative import in non-package

The plugin loads another module from the same directory on line 3 ...
import sublime, sublime_plugin
import os.path
from . import converter

How can I allow this loading? How can I load a relative import, or how can I make sure that open_related is not a 'non-package' anymore?
Last edited by desperado70 on Tue Apr 23, 2013 9:36 am, edited 1 time in total.
desperado70
 
Posts: 5
Joined: Thu Aug 30, 2012 11:39 am

Re: ValueError: Attempted relative import in non-package

Postby desperado70 on Tue Apr 23, 2013 9:36 am

For reference of others struggling with the same problem: I have it solve by changing the line

from . import converter
to
import converter

Works again now.
desperado70
 
Posts: 5
Joined: Thu Aug 30, 2012 11:39 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 9 guests