2

Quite recently, the Gnome Shell Integration plugin started failing on both Firefox and Chrome.

After some investigation I updated the requests module from pip3 but got another error:

  File "/usr/bin/chrome-gnome-shell", line 220, in on_input
request = json.loads(text)
[10391] Exception: module 'json' has no attribute 'loads'

I did some further investigation, found this GitHub issue about conflicting json modules and went on finding if I had any file named json.py on my filesystem. I deleted every one of them I found but the error is still there.

Then I opened an interactive Python shell to check, still no luck:

$ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
>>> import json
>>> json.loads
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'json' has no attribute 'loads'
>>> json.__path__
_NamespacePath(['/usr/local/lib/python3.6/dist-packages/json'])
>>> json.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'json' has no attribute '__file__'

I'm out of guesses as to what my problem is. Do you have any idea?

Thanks.


Some additional info:

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bionic
$ uname -a
Linux capt-XPS-13-9370 4.15.0-1050-oem #57-Ubuntu SMP Wed Aug 7 10:34:10 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ find / -name "json" 2>/dev/null
/home/capt/.config/yarn/global/node_modules/@angular-devkit/core/src/json
/home/capt/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/info/json
/home/capt/.cache/yarn/v2/npm-fs-extra-4.0.3-0d852122e5bc5beb453fb028e9c0c9bf36340c94/lib/json
/home/capt/.cache/yarn/v2/npm-fs-extra-6.0.1-8abc128f7946e310135ddc93b98bddb410e7a34b/lib/json
/home/capt/.cache/yarn/v2/npm-istanbul-reports-2.0.1-fb8d6ea850701a3984350b977a969e9a556116a7/lib/json
/home/capt/.cache/yarn/v2/npm-fs-extra-7.0.1-4f189c44aa123b895f722804f55ea23eadc348e9/lib/json
/home/capt/.cache/yarn/v2/npm-@angular-devkit/core-0.7.5-49f7854ccadf3ddda8d0ea4359543a1cbdc6854d/src/json
/home/capt/.cache/yarn/v2/npm-@angular-devkit/core-7.3.2-67ac2cfcbe47f1e457929c19ab1b04c9e061b2e2/src/json
/home/capt/.cache/yarn/v2/npm-core-js-2.5.7-f972608ff0cead68b841a16a932d0b183791814e/fn/json
/home/capt/.cache/yarn/v2/npm-core-js-2.5.7-f972608ff0cead68b841a16a932d0b183791814e/library/fn/json
/home/capt/.cache/yarn/v2/npm-core-js-2.3.0-fab83fbb0b2d8dc85fa636c4b9d34c75420c6d65/fn/json
/home/capt/.cache/yarn/v2/npm-core-js-2.3.0-fab83fbb0b2d8dc85fa636c4b9d34c75420c6d65/library/fn/json
/home/capt/.cache/yarn/v2/npm-babel-runtime-6.26.0-965c7058668e82b55d7bfe04ff2337bc8b5647fe/core-js/json
/home/capt/.cache/yarn/v2/npm-libphonenumber-0.0.10-e78bbf6601989cd09fa43504764688d41794148c/lib/closure/goog/json
/home/capt/.npm_modules/lib/node_modules/serverless/node_modules/core-js/fn/json
/home/capt/.npm_modules/lib/node_modules/serverless/node_modules/core-js/library/fn/json
/home/capt/.npm_modules/lib/node_modules/serverless/node_modules/fs-extra/lib/json
/home/capt/.npm_modules/lib/node_modules/serverless/node_modules/babel-runtime/core-js/json
/home/capt/.npm_modules/lib/node_modules/serverless/node_modules/aws-sdk/lib/json
/home/capt/.gradle/caches/modules-2/files-2.1/org.json/json
/home/capt/.gradle/caches/modules-2/metadata-2.58/descriptors/org.json/json
/home/capt/IdeaProjects/prj-front/node_modules/libphonenumber/lib/closure/goog/json
/home/capt/IdeaProjects/prj-front/node_modules/jszip/node_modules/core-js/fn/json
/home/capt/IdeaProjects/prj-front/node_modules/jszip/node_modules/core-js/library/fn/json
/home/capt/IdeaProjects/prj-front/node_modules/istanbul-reports/lib/json
/home/capt/IdeaProjects/prj-front/node_modules/core-js/fn/json
/home/capt/IdeaProjects/prj-front/node_modules/core-js/library/fn/json
/home/capt/IdeaProjects/prj-front/node_modules/fs-extra/lib/json
/home/capt/IdeaProjects/prj-front/node_modules/babel-runtime/core-js/json
/home/capt/IdeaProjects/prj-front/node_modules/@angular-devkit/core/src/json
/home/capt/IdeaProjects/prj-front/node_modules/find-yarn-workspace-root/node_modules/fs-extra/lib/json
/home/capt/IdeaProjects/PrjApi/build/resources/test/json
/home/capt/IdeaProjects/PrjApi/build/classes/java/main/com/prj/Prjapi/converter/json
/home/capt/IdeaProjects/PrjApi/src/main/java/com/prj/Prjapi/converter/json
/home/capt/IdeaProjects/PrjApi/src/test/resources/json
/usr/share/iso-codes/json
/usr/local/lib/python3.6/dist-packages/json
/usr/lib/python2.7/json
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/json
/usr/lib/python3.6/json
/usr/lib/ruby/2.5.0/psych/json
/usr/lib/ruby/2.5.0/json
/snap/aws-cli/146/usr/lib/python3.6/json
/snap/core18/1074/usr/lib/python3.6/json
/snap/core18/1098/usr/lib/python3.6/json
/snap/gnome-3-28-1804/67/usr/lib/python3.6/json
/snap/gnome-3-28-1804/67/usr/share/iso-codes/json
/snap/gnome-3-28-1804/71/usr/lib/python3.6/json
/snap/gnome-3-28-1804/71/usr/share/iso-codes/json
/snap/core/7396/usr/lib/python3.5/json
/snap/core/7270/usr/lib/python3.5/json
/snap/intellij-idea-ultimate/165/plugins/spy-js/server/node_modules/archiver/lib/modules/json
/snap/intellij-idea-ultimate/165/plugins/textmate/lib/bundles/json
/snap/intellij-idea-ultimate/159/plugins/spy-js/server/node_modules/archiver/lib/modules/json
/snap/intellij-idea-ultimate/159/plugins/textmate/lib/bundles/json
/var/lib/gems/2.5.0/gems/activesupport-5.0.7/lib/active_support/json
/var/lib/gems/2.5.0/gems/activesupport-5.0.6/lib/active_support/json
  • I'm not sure this helps, but are there any __init__.py files in a directory called json? – Chris W. Oct 10 '19 at 4:13
  • 1
    I think there may be a /usr/local/lib/python3.6/dist-packages/json/__init__.py that you may want to try removing. – Chris W. Oct 10 '19 at 4:21
  • 1
    Try in python: help(json) Also the newer versions of firefox and gnome do not need the shell integration plugin, I'm running it just fine looking great on Fedora without the plugin. – Oxygen Oct 10 '19 at 15:25
  • Indead @ChrisW. , the /usr/local/lib/python3.6/dist-packages/json was the cultprit! – Captain H. Oct 14 '19 at 10:00
  • 1
    I'm not sure I can award the bounty on a comment, would you mind answering so I can award you @ChrisW. ? – Captain H. Oct 14 '19 at 10:01
0
+50

There may be a directory named json in your sys.path containing an __init__.py that could be the culprit. Try removing that and see if that helps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.