+ 3
Do I need to adapt codes for SL?
Hello Everyone, Yesterday I wrote some code on my IDE and it works perfect. So, I wanted to post it on SL, but for some reason won't work in the same way. On SL I get an EOF-exeption. How do I solve this? *EDIT: The code can be found on my profile. Many thanks, Jay Aberlour
6 odpowiedzi
+ 11
Hi Jay,
It is a limitation of the compiler here. Since compiled code is run on the server and results sent back to your device, all inputs must be entered a runtime.
In your case, unless the input is correct first time, 3 incorrect attempts must be entered in the displayed prompt to get the code to display access denied.
+ 10
Instead of input() at the message for correct input, you need exit() or the loop continues to run
+ 4
I think the issue is that it continues to search for username and password even after you submit the correct one. Try breaking out of the loop when you get it right. I'm not sure if python has the 'break' keyword, but that's what you need
+ 4
@jay the input() is an trick I used in college. When you open an python-program, the CLI closes as soon as it reaches the end, but that's way to soon for a user. The input() makes the screen stay open.
@Zeke Williams a break is certainly possible. But om my IDE this way works. Do you think the break wil solve the problem on SL?
+ 3
Thank you Jay,
Actually, I didn't even get to an wrong input. You're probably right, but the EOF-exeption starts as soon as an input is given.
+ 3
I think it worked for me. It certainly can't hurt to try it :)