Closed BkunS closed 7 years ago
"http error [500]" means leetcode.com response a 500 HTTP error, you can run leetcode show command again with "-vv" to enable trace log to see what happens in the HTTP traffic.
e.g.
leetcode show 1 -gxl java -vv
I guess it might be due to the api change on leetcode side that the "show" command no longer gives the problem descriptions. Would you mind checking it? Cuz without the descriptions, the leetcode-cli is almost useless. And here's what I got for running the code:
$ leetcode submit 576.out-of-boundary-paths.java -vv [TRACE] REQUEST %s { url: 'https://leetcode.com/api/problems/algorithms/', headers: { Cookie: 'LEETCODE_SESSION=;csrftoken=;', 'X-CSRFToken': '', 'X-Requested-With': 'XMLHttpRequest' }, expectedStatus: 200, retry: 0, callback: [Function] } [TRACE] REQUEST %s make request https://leetcode.com/api/problems/algorithms/ [TRACE] REQUEST %s onRequestResponse https://leetcode.com/api/problems/algorithms/ 200 { server: 'nginx', date: 'Fri, 09 Jun 2017 03:27:53 GMT', 'content-type': 'text/html; charset=utf-8', 'transfer-encoding': 'chunked', connection: 'close', vary: 'Accept-Encoding, Accept, Cookie', 'x-frame-options': 'SAMEORIGIN', allow: 'GET, HEAD, OPTIONS' } [TRACE] REQUEST %s reading response's body [TRACE] REQUEST %s finish init function https://leetcode.com/api/problems/algorithms/ [TRACE] REQUEST %s response end https://leetcode.com/api/problems/algorithms/ 200 { server: 'nginx', date: 'Fri, 09 Jun 2017 03:27:53 GMT', 'content-type': 'text/html; charset=utf-8', 'transfer-encoding': 'chunked', connection: 'close', vary: 'Accept-Encoding, Accept, Cookie', 'x-frame-options': 'SAMEORIGIN', allow: 'GET, HEAD, OPTIONS' } [TRACE] REQUEST %s end event https://leetcode.com/api/problems/algorithms/ [TRACE] REQUEST %s has body https://leetcode.com/api/problems/algorithms/ 240505 [TRACE] REQUEST %s emitting complete https://leetcode.com/api/problems/algorithms/ [TRACE] REQUEST %s { url: 'https://leetcode.com/problems/out-of-boundary-paths/submit/', headers: { Cookie: ;', 'X-CSRFToken': '', 'X-Requested-With': 'XMLHttpRequest', Origin: 'https://leetcode.com', Referer: 'https://leetcode.com/problems/out-of-boundary-paths' }, expectedStatus: 200, retry: 0, body: { judge_type: 'large', lang: 'java', question_id: 576, test_mode: false, typed_code: '/\r\n [576] Out of Boundary Paths\r\n \r\n https://leetcode.com/problems/out-of-boundary-paths\r\n \r\n Hard (33.35%)\r\n Total Accepted: \r\n Total Submissions: \r\n Testcase Example: \'2\n2\n2\n0\n0\'\r\n \r\n Can you solve this problem? 🤔\r\n /\r\npublic class Solution {\r\n public int findPaths(int m, int n, int N, int i, int j) {\r\n\t\treturn 0;\r\n }\r\n}\r\n' }, method: 'POST', json: true, _delay: 1, callback: [Function] } [TRACE] REQUEST %s make request https://leetcode.com/problems/out-of-boundary-paths/submit/ [TRACE] REQUEST %s onRequestResponse https://leetcode.com/problems/out-of-boundary-paths/submit/ 500 { server: 'nginx', date: 'Fri, 09 Jun 2017 03:27:55 GMT', 'content-type': 'text/html; charset=utf-8', 'transfer-encoding': 'chunked', connection: 'close', vary: 'Cookie', 'x-frame-options': 'SAMEORIGIN' } [TRACE] REQUEST %s reading response's body [TRACE] REQUEST %s finish init function https://leetcode.com/problems/out-of-boundary-paths/submit/ [TRACE] REQUEST %s response end https://leetcode.com/problems/out-of-boundary-paths/submit/ 500 { server: 'nginx', date: 'Fri, 09 Jun 2017 03:27:55 GMT', 'content-type': 'text/html; charset=utf-8', 'transfer-encoding': 'chunked', connection: 'close', vary: 'Cookie', 'x-frame-options': 'SAMEORIGIN' } [TRACE] REQUEST %s end event https://leetcode.com/problems/out-of-boundary-paths/submit/ [TRACE] REQUEST %s has body https://leetcode.com/problems/out-of-boundary-paths/submit/ 27 [TRACE] REQUEST %s invalid JSON received https://leetcode.com/problems/out-of-boundary-paths/submit/ [TRACE] REQUEST %s emitting complete https://leetcode.com/problems/out-of-boundary-paths/submit/
Seems there are at least 2 issues:
I know what was going on. Guess my terminal doesn't have the right font or encoding to display some symbols as you just pointed out, and it went in the java file as squares which causes the problem. By deleting those squares solves the problem.
I think this issue is good to be closed.
After you updated leetcode-cli, you can remove the cache (~/.lc/out-of-boundary-paths.json), and it will show the right description as expected:
$ leetcode show 576
[576] Out of Boundary Paths
https://leetcode.com/problems/out-of-boundary-paths
* Hard (33.34%)
* Total Accepted: 2279
* Total Submissions: 6836
* Testcase Example: '2\n2\n2\n0\n0'
There is an m by n grid with a ball. Given the start coordinate (i,j) of the ball, you can move the ball to adjacent cell or cross the grid boundary in four directions (up, down, left, right). However, you can at most move N times. Find out the number of paths to move the ball out of grid boundary. The answer may be very large, return it after mod 109 + 7.
Example 1:
Input:m = 2, n = 2, N = 2, i = 0, j = 0
Output: 6
Explanation:
Example 2:
Input:m = 1, n = 3, N = 3, i = 0, j = 1
Output: 12
Explanation:
Note:
Once you move the ball out of boundary, you cannot move it back.
The length and height of the grid is in range [1,50].
N is in range [0,50].
Has new version updated on npm yet? It seems it is still 0.10.0 and nothing changed.
not published to npm yet, while you can install from github directly
$ npm install -g skygragon/leetcode-cli
I have permission issues of npm installing from private repo though there are some ways to work around, but no real solutions. I guess I'll just stick with official npm version and try installing it later when it's updated. Thanks a lot!
Are you saying the npm permission issue when trying to install it globally?
I have no issues installing it globally with sudo command, but have issues installing it from private GitHub repo. I saw the version on npm has bumped to 0.10.1, and after updating to it seems everything works again. Thanks!
[ERROR] Error: connect ECONNREFUSED 104.27.161.90:443 [0] why I had the issue in ubuntu 16.04 OS ?
@Pyboon most time this connection refused error is due to a bad networking, it's too complex since every hop (e.g. routers, firewalls) might be the reason...
Updated to 0.10.0 and logged in, but "leetcode show" command can no longer display the description of the problem. When I try to submit the solution generated by "leetcode show [Number] -g -x -l java", it always returns "[ERROR] http error [500]", but "leetcode test" command works just fine.