Home Download Buy Blog Forum Support

ST3 on_api_ready issue

ST3 on_api_ready issue

Postby jburnett on Mon Feb 04, 2013 10:51 pm

In 3010, on_api_ready() is iterating over sys.modules.values() directly (sublime_plugin.py:133). If a plugin does something like an import inside its plugin_loaded function, ST will bail with a RuntimeError ("dictionary changed size during iteration"). It might be better to capture modules.values() into a list before iterating to guard against that?
Posts: 95
Joined: Wed Jul 27, 2011 9:23 pm

Re: ST3 on_api_ready issue

Postby wbond on Tue Feb 05, 2013 2:51 pm

I am curious about how you are using on_api_read in your plugin. I was looking for something like that when I started porting PC because I needed to check the version of PC to determine what import code to run.

Would it solve your problem if sublime.version(), sublime.arch() and sublime.platform() were available always? I don't know if that is possible, but it would certainly make some of my import code a little cleaner.
Posts: 568
Joined: Mon Feb 28, 2011 5:33 am

Re: ST3 on_api_ready issue

Postby atomi on Tue Feb 05, 2013 10:16 pm

here's what i'm doing:

Code: Select all
    import py3modules
else ImportError:
    import py2.6modules

def _import_modules():
    blah = sublime.blah # we have sublime
    # run all my imports here that need sublime avaialble

if not sublime.version():
def plugin_loaded():
Posts: 345
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: ST3 on_api_ready issue

Postby jps on Wed Feb 06, 2013 3:35 am

jburnett: Will fix for the next build

wbond: I'll modify the next build so that sublime.version() and friends can be called at any time
Site Admin
Posts: 3217
Joined: Wed Mar 19, 2008 12:33 pm

Return to General Discussion

Who is online

Users browsing this forum: davidtvsa, Google [Bot] and 17 guests