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

Our product is not giving correct output. #44

Closed
1 task
shivankgtm opened this issue Jan 19, 2019 · 16 comments
Closed
1 task

Our product is not giving correct output. #44

shivankgtm opened this issue Jan 19, 2019 · 16 comments

Comments

@shivankgtm
Copy link
Contributor

shivankgtm commented Jan 19, 2019

  • I am submitting this regarding a:

    • Bug report
  • Description of the ISSUE:
    it's not telling the output correctly. though following part of the code looks good when we see it.

expected = expected.strip()
    uploaded = uploaded.strip()
    ans = (uploaded==expected)
    
    if not ans:
        return "Wrong Answer!!"
    else:
        
        return "Solved! Great Job! "

expected and present behavior

  • I solved the question1 of adding two numbers and submitted on our platform but it's not showing the "Wrong Answer".
  • I should have got "Solved! Great Job".

someone need to look into it and see what's going on.

@theSage21
Copy link
Member

can you supply your output file?

@shivankgtm
Copy link
Contributor Author

output.txt

@theSage21
Copy link
Member

Supplying this file via requests:

import requests
r = requests.post('http://localhost:8080/upload', files={'upload': open('output.txt', 'rb')})
print(r.text)

reproduces the bug. The problem is still there even if we supply the actual expected_output file, meaning the issue is in the python server.

The problem is there because "arjoonn" == "arjoonn".encode() will always give False

I've verified that this is indeed the problem. I will leave the actual code fix open for someone else to do.

@arnabsinha99
Copy link
Contributor

@theSage21 I did not get the cause of the problem i.e. how does "arjoon"=="arjoon".encode() cause the problem?

@theSage21
Copy link
Member

That is for you to figure out. You can explore the code using print statements or a debugger if your editor/IDE provides one. If I point out why it's the cause, there will be no learning.

  • Try to understand Why 'arjoonn' == 'arjoonn'.encode() gives False
  • Try to find out why this affects our code

@arnabsinha99
Copy link
Contributor

That is for you to figure out. You can explore the code using print statements or a debugger if your editor/IDE provides one. If I point out why it's the cause, there will be no learning.

  • Try to understand Why 'arjoonn' == 'arjoonn'.encode() gives False
  • Try to find out why this affects our code

Sure I will look into it. :-)

@arnabsinha99
Copy link
Contributor

* **I am submitting this regarding a:**
  
  * [ ]  Bug report

* **Description of the ISSUE:**
  it's not telling the output correctly. though following part of the code looks good when we see it.
expected = expected.strip()
    uploaded = uploaded.strip()
    ans = (uploaded==expected)
    
    if not ans:
        return "Wrong Answer!!"
    else:
        
        return "Solved! Great Job! "

expected and present behavior

* I solved the question1 of adding two numbers and submitted on our platform but it's not showing the "Wrong Answer".

* I should have got "Solved! Great Job".

someone need to look into it and see what's going on.

You mean it is showing Wrong answer right? I am not getting any output when I am submitting any file. Where can you see your output?

@arnabsinha99
Copy link
Contributor

Supplying this file via requests:

import requests
r = requests.post('http://localhost:8080/upload', files={'upload': open('output.txt', 'rb')})
print(r.text)

reproduces the bug. The problem is still there even if we supply the actual expected_output file, meaning the issue is in the python server.

The problem is there because "arjoonn" == "arjoonn".encode() will always give False

I've verified that this is indeed the problem. I will leave the actual code fix open for someone else to do.

Where did you place this snippet of code? In an independent file? @theSage21

@theSage21
Copy link
Member

yes. In an independent file

@arnabsinha99
Copy link
Contributor

import requests
r = requests.post('http://localhost:8080/upload', files={'upload': open('output.txt', 'rb')})
print(r.text)

I use VSCode 2015. The above code, in an independent file, ran once, gave "Wrong Answer". Then on running the code once again, I got the following error:-
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it .
I searched the net but could not understand any solution that I found. Could you suggest what I can do?

@theSage21
Copy link
Member

Is your server running? Connection errors usually happen when the server shuts down.

@arnabsinha99
Copy link
Contributor

Is your server running? Connection errors usually happen when the server shuts down.

How do I check if it is running or not?

@theSage21
Copy link
Member

How did you run it? I'm not familiar with VS Code. Wherever you ran the server file there the process should be running.

@arnabsinha99
Copy link
Contributor

How did you run it? I'm not familiar with VS Code. Wherever you ran the server file there the process should be running.

@theSage21 I put the file having this code in the local repository of PyJudge i.e. where server.py exists. I then executed the code.

@theSage21
Copy link
Member

theSage21 commented Jan 22, 2019 via email

@cquark7
Copy link
Contributor

cquark7 commented Jan 24, 2019

I solved this issue just by adding 1 character to the existing server.py script.
My travis-ci checks are failing. Don't know what's wrong.
I created a local repo by cloning PyJudge.
Made some changes and pushed them to my fork.
Sent PR.

Please suggest some workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants