0

I am trying to convert a python program file into an app, following this tutorial.

My program needs to take the user input, however:

 print("What DOMAIN do you want to block?")
 print("Example: youtube.com")
 websitebeingblocked = input()

When I run my program, it prints out:

ValueError: invalid literal for int() with base 10

I tried following the answers to this question, but my program still doesn't work. I think it went wrong when I asked for user input - how can I solve this?

Please please help me; I still have not found a solution. Even a comment would really help!

Rebecca Bibye
  • 190
  • 2
  • 18
  • You tagged this post python 3.x, but it looks like that error is because you are using python 2. – jordanm Dec 14 '20 at 20:05
  • What do you mean by "converting a program to an app". What do you mean by a program versus an app? Also, please post the full stacktrace, as well as your Python version. – Random Davis Dec 14 '20 at 20:05
  • @RandomDavis In can in python2, because `input()` in python2 is the same as `eval(input())` in python3 – jordanm Dec 14 '20 at 20:06
  • @jordanm really? I use python 3 in idle. How do I make it parse the program as python 3? – Rebecca Bibye Dec 14 '20 at 20:06
  • @jordanm or should I just replace it with eval(input()) ? – Rebecca Bibye Dec 14 '20 at 20:06
  • For python2 you want `raw_input()` instead of `input()`, but using py2 is not recommended because it's been EOL for a year now – jordanm Dec 14 '20 at 20:07
  • so for python 3 should I just use eval(input()) ? – Rebecca Bibye Dec 14 '20 at 20:08
  • 1
    "I think it went wrong when I asked for user input" - I'm not convinced. Did you see any of the print statements before the input? I skimmed through that tutorial video and it is using python2.7. I am not sure what it is doing to your python code to make it an executable but it is quite possible that something it "adds" is generating that error. Try creating a new ultra simple "Hello World" program and run that through the "convert to exe" process and check it works or (more likely) if you get the same error. – Martin Dec 16 '20 at 15:57
  • OH! I didn't notice it was Python 2.7! That's probably what's causing the error. Thank you!! Do you mind writing that as an answer so I can close this question? – Rebecca Bibye Dec 16 '20 at 19:13

0 Answers0