Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid use of JSONDecodeError with Python 2.7 #3309

Closed
pavoljuhas opened this issue Dec 12, 2018 · 2 comments
Closed

Invalid use of JSONDecodeError with Python 2.7 #3309

pavoljuhas opened this issue Dec 12, 2018 · 2 comments
Labels
locked [bot] locked due to inactivity

Comments

@pavoljuhas
Copy link

pavoljuhas commented Dec 12, 2018

7aa44a7 introduced json.decoder.JSONDecodeError which does not exist in Python 2.7.
The following patch should fix that:

From d6ed0f0a2ee3492dafad7790ccc161e4dc54deec Mon Sep 17 00:00:00 2001
From: Pavol Juhas <pavol.juhas@gmail.com>
Date: Wed, 12 Dec 2018 11:41:57 -0500
Subject: [PATCH] Avoid use of undefined JSONDecodeError

Python 2.7 does not have `json.decoder.JSONDecodeError`.
Solution: replace with mock JSONDecodeError.
---
 conda_build/index.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/conda_build/index.py b/conda_build/index.py
index 9f1ccc8c..363302bb 100644
--- a/conda_build/index.py
+++ b/conda_build/index.py
@@ -169,7 +169,7 @@ def _download_channeldata(channel_url):
         try:
             with open(tf) as f:
                 data = json.load(f)
-        except json.decoder.JSONDecodeError:
+        except JSONDecodeError:
             data = {}
     return data
 
@@ -270,7 +270,7 @@ def get_build_index(subdir, bldpkgs_dir, output_folder=None, clear_cache=False,
                             with open(channeldata_file, "r+") as f:
                                 channel_data[channel.name] = json.load(f)
                             break
-                        except (IOError, json.decoder.JSONDecodeError):
+                        except (IOError, JSONDecodeError):
                             time.sleep(0.2)
                             retry += 1
                 else:
-- 
2.19.2
@msarahan
Copy link
Contributor

duplicate of #3307, closing

@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically locked because it has not had recent activity after being closed.

Please open a new issue if needed.

Thanks!

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Mar 11, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

No branches or pull requests

2 participants