Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Fixed urllib import issue #11

Closed
wants to merge 1 commit into from
Closed

Conversation

laurent22
Copy link

@laurent22 laurent22 commented Oct 7, 2016

For some reason this plugin no longer worked for me. Maybe it's due to a recent update of ST or something else.

The urllib.parse namespace along with the quote() and unquote() functions were no longer accessible, resulting in an error AttributeError: 'module' object has no attribute 'parse' on line 40.

I don't know much about Python but after various attempts I've eventually fixed it by explicitly importing the two functions in the header.

@btoews
Copy link
Owner

btoews commented Oct 7, 2016

What version of Submlime test are you using?

@laurent22
Copy link
Author

It's build 3126

@btoews
Copy link
Owner

btoews commented Oct 7, 2016

I'm running the same build without issue. How did you install the package, and where were you seeing the error?

@laurent22
Copy link
Author

I've installed it through Package Control initially, then I've unpacked it to my local directory so that I can debug it and in both cases I had this error.

The error appeared in the console (and still does if I revert to the previous code):

reloading plugin URLEncode.urlencode
Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 818, in run_
    return self.run(edit)
  File "/home/laurent/.config/sublime-text-3/Packages/URLEncode/urlencode.py", line 87, in run
    view.replace(edit, region, unquote(view, s))
  File "/home/laurent/.config/sublime-text-3/Packages/URLEncode/urlencode.py", line 42, in unquote
    return urllib.parse.unquote(s)
AttributeError: 'module' object has no attribute 'parse'

@btoews
Copy link
Owner

btoews commented Oct 7, 2016

Strange. I've got the exact same setup. Can you try entering this into to the console and pasting the results here: import urllib; print(repr(urllib)); print(repr(urllib.parse))

Here's what I get on my machine:

>>> import urllib; print(repr(urllib)); print(repr(urllib.parse))
<module 'urllib' from '/Applications/Sublime Text.app/Contents/MacOS/python3.3.zip/urllib/__init__.pyo'>
<module 'urllib.parse' from '/Applications/Sublime Text.app/Contents/MacOS/python3.3.zip/urllib/parse.pyo'>

@laurent22
Copy link
Author

Looks like I'm getting the same error:

>>> import urllib; print(repr(urllib)); print(repr(urllib.parse))
<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'

The strange thing is that if I unzip this python3.3.zip file, the relevant lib is there:

drwxrwxr-x  2 laurent laurent 4.0K Oct  7 17:05 ./
drwxrwxr-x 26 laurent laurent 4.0K Oct  7 17:05 ../
-rw-r--r--  1 laurent laurent  125 Sep 22 23:37 __init__.pyo
-rw-r--r--  1 laurent laurent 3.5K Sep 22 23:37 error.pyo
-rw-r--r--  1 laurent laurent  39K Sep 22 23:37 parse.pyo
-rw-r--r--  1 laurent laurent 101K Sep 22 23:37 request.pyo
-rw-r--r--  1 laurent laurent 5.5K Sep 22 23:37 response.pyo
-rw-r--r--  1 laurent laurent 8.8K Sep 22 23:37 robotparser.pyo

@btoews
Copy link
Owner

btoews commented Oct 7, 2016

Very strange. I don't have any bright ideas for how to fix this. It doesn't seem to be a bug in this package though, so I'm going to close this PR. Sorry I can't be more helpful.

@btoews btoews closed this Oct 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants