Stop using ST2. ST3 is the future!
Open http / www files at once?
Sorry I wasnât clear in my last post. When I run this generator;
import collections, webbrowser; gen = (("opening '%s'" % link, webbrowser.open(link)) for link in list(collections.OrderedDict.fromkeys(view.substr(sel) for sel in view.sel()).keys()))
I get an AttributeError: âmoduleâ object has no attribute âOrderedDictâ ?
FichteFoll has already answered that - OrderedDict is a Python 3 thing, Sublime Text 2 uses Python 2, while ST3 uses Python 3. Really, there is no reason to not be using ST3.
I read that OrderedDict is available in Python 2.7+ considering I have 2.7.3 installed, shouldnât the command not work ?
it depends which version comes with ST2 - ST uses a built in version of Python for plugins, and it doesnât matter what version or modules might be installed on the system, ST doesnât use/see them.
OrderedDict has been added in python 2.7 and ST2 uses python 2.6.
This is a little bit ugly, but should also work in ST2:
import webbrowser; visited = set([]); gen = (("opening '%s'" % link, webbrowser.open(link)) for link in list(view.substr(sel) for sel in view.sel()) if link not in visited and not visited.add(link))
r-stein - I assume because of the error, the following command must be changed ?
Iâm getting an error âcollectionsâ is not defined ?
The generator even though itâs as you say âuglyâ did work
What do you call the command after the generator is created so I can explain the problem a little better ?