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

in build.py self.do_compile (line 274) not returning valid JSON #1399

Closed
shawt opened this Issue Oct 27, 2017 · 7 comments

Comments

Projects
None yet
3 participants
@shawt
Copy link

shawt commented Oct 27, 2017

Problem statement

As of last night, build.py began failing with the following error:

Exception in thread Thread-2:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "build.py", line 176, in run
self.gen_core()
File "build.py", line 209, in gen_core
self.do_compile(params, target_filename, filenames, "")
File "build.py", line 274, in do_compile
json_data = json.loads(json_str)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

  • [X ] Bug report
  • Feature request

What were you trying to do when you hit this bug? Or, what do you want to do with Blockly that your proposed feature would enable?

Trying to compile into compressed files by running build.py

Please describe what should happen. Include screenshots if applicable.

build.py should complete with no errors.

Describe what actually happens. Include screenshots if applicable.

When I run sudo python build.py many modules compile. Right after /msg/js/zh-hant.js, I get the error pasted above.

Explain what someone needs to do in order to see what's described in Actual behavior above

Stack Traces

Please open up the console.  If you see any Blockly-related errors, paste them here.
See above.

Operating System and Browser

-[x] Terminal window OS X

  • Desktop:

    • Chrome
    • Firefox
    • Safari
    • Opera
    • IE 10+
    • IE 11
    • EDGE
  • Smartphone/Tablet/Chromebook (please complete the following information):

    • Device: [e.g. iPhone6]
    • OS: [e.g. iOS8.1]
    • Browser [e.g. stock browser, safari]
    • Version [e.g. 22]

Additional Information

Anything else we should know?

@shawt

This comment has been minimized.

Copy link
Author

shawt commented Oct 27, 2017

Here are the relevant lines (264-74) in my build.py. Looks like I am a few revs behind, but if something changed on Google's side, is there a way to provide some backward compatibility, so that I don't have to update blockly immediately?

def do_compile(self, params, target_filename, filenames, remove):
    # Send the request to Google.
    headers = {"Content-type": "application/x-www-form-urlencoded"}
    conn = httplib.HTTPConnection("closure-compiler.appspot.com")
    conn.request("POST", "/compile", urllib.urlencode(params), headers)
    response = conn.getresponse()
    json_str = response.read()
    conn.close()

    # Parse the JSON response.
    json_data = json.loads(json_str)
@rachel-fenichel

This comment has been minimized.

Copy link
Collaborator

rachel-fenichel commented Oct 27, 2017

I just tried and can't make it work from master or scratch-blocks develop, but can make it work from blockly develop.

@NeilFraser

This comment has been minimized.

Copy link
Member

NeilFraser commented Oct 27, 2017

Confirming failure on master (but not develop) as Rachel stated. Deleting my earlier incorrect guess.

@NeilFraser

This comment has been minimized.

Copy link
Member

NeilFraser commented Oct 27, 2017

Unpeeled the onion by a couple of layers. 'develop' appeared to be working because for some reason someone reconfigured it to either build compressed files xor build the demo files. When the demo build was removed, this accidentally started xoring the build against accessible files instead.

PR #1401 fixes this issue, thus breaking 'develop' to match 'master'. This PR also reveals that the online Closure Compiler is returning a blank response for all eight compression operations. Looks like the online Closure Compiler is just having a bad day, but I'll still investigating...

@NeilFraser

This comment has been minimized.

Copy link
Member

NeilFraser commented Oct 27, 2017

Got to the centre of the onion and found the root issue: the online Closure Compiler no longer accepts http requests. It is now https only. Good for them. Making changes to our build script now.

@NeilFraser

This comment has been minimized.

Copy link
Member

NeilFraser commented Oct 27, 2017

PR #1401 fixes everything for the develop branch.
PR #1402 fixes everything for the master branch.

If anyone wants to fix this manually, just find "HTTPConnection" in build.py and change it to "HTTPSConnection". One letter change.

Thanks for the bug report!

@NeilFraser NeilFraser closed this Oct 27, 2017

rachel-fenichel added a commit to LLK/scratch-blocks that referenced this issue Oct 27, 2017

@NeilFraser

This comment has been minimized.

Copy link
Member

NeilFraser commented Oct 31, 2017

Closure Compiler documentation updates are now in progress.

timdawborn added a commit to groklearning/blockly that referenced this issue Oct 31, 2017

@rachel-fenichel rachel-fenichel referenced this issue Nov 13, 2017

Merged

November 2017 merge to master #1439

0 of 12 tasks complete

jwtlake added a commit to MRN-Code/coins-blockly that referenced this issue Nov 22, 2017

jwtlake added a commit to MRN-Code/coins-blockly that referenced this issue Nov 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment