Sublime Forum

Module error when running a plugin

#1

I’m having a strange error with the URLEncode plugin, which used to work but now doesn’t.

It’s making a call to urllib.parse.quote(s, safe='') which now fails with an error AttributeError: 'module' object has no attribute 'parse' and indeed, when I try to run this command in the console:

import urllib; print(repr(urllib)); print(repr(urllib.parse))

it results in this error:

<module 'urllib' from '/opt/sublime_text/python3.3.zip/urllib/__init__.pyo'>
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'parse'

I’ve managed to fix the error by importing the lib in a different way, although since I don’t know much about Python, I don’t really understand why it works.

For more information, please see this pull request. Unfortunately the author decided to close it, but maybe if I can figure out what’s happening I could convince him to reopen it.

So I’m wondering what could be causing this error?

(This is on Ubuntu 16 by the way - it works for me on Windows, and for him on MacOS. Don’t know if it’s specific to Ubuntu though or due to something else)

0 Likes

#2

I’ve just tried in a VM with Ubuntu and it seems to work fine in build 3114 and 3126 (64bits)

Did you already tried install ST again?

0 Likes

#3

Thy also reinstalling the plugin.

0 Likes

#4

There is mention of this problem in this thread on the forum, starting around here.

I’d make sure that you’re running build 3126 (you don’t mention your build) and if you are, that your version of PackageControl is up to date (assuming you use it), Some people had problems with PackageControl on update , and conceivably may have left it in a state where it’s not fully upgraded. If you’re unsure, removing and reinstalling PackgeControl might help.

0 Likes

#5

Ok actually the XDebug plugin was broken as well because of this bug.

If someone comes across the same issue, this is how I’ve fixed it:

First I’ve uninstalled Package Control and reinstalled it.

However, after restarting Sublime Text, Package Control moved all the packages in Packages/User/Package Control.sublime-settings to ignored_packages in Packages/User/Preferences.sublime-settings so nothing worked.

Thankfully I’m versioning my config folder otherwise I’d have no idea what it’s doing. After moving the packages config back to Packages/User/Package Control.sublime-settings and restarting Sublime Text it worked again.

1 Like