shahabou Posted April 17, 2020 Posted April 17, 2020 (edited) Hi.First of all thanks in advance because of all amazing features!I need this module to use Telegram bot API as the name of module tell this too if I can.It can be installed by pip3 install python-telegram-botalso to kill two birds with one stone, currently I added #!/usr/bin/pythonat the first line of my .py script, but I want to use Python 3.7, how should I edit this line to use Python 3.7? below lines doesn't works: #!/usr/bin/python3.7 #!/usr/local/python3.7 #!/usr/local/bin/python3.7note that I Copy-paste the code into cPanel built-in editor and im not using windows (so there shouldn't be line-ending problem as I think!) code is here, located in Public_html : #!/usr/bin/python import requests print "Content-type: text/html\n\n" print "Python is working fine.\r\n <br>" contents = requests.get('https://random.dog/woof.json').json() url = contents['url'] print ('<img src="'+url+'">');thanks again. Edited April 17, 2020 by shahabou
Luigi123 Posted April 18, 2020 Posted April 18, 2020 Let’s see what our root admin, Krydos has to say about it. Escalating
Krydos Posted April 18, 2020 Posted April 18, 2020 The shebang for python 3.7 on Johnny is #!/usr/bin/python3.7 The module python-telegram-bot has been installed on Johnny's python3.7 https://krydos2.heliohost.org/cgi-bin/modules37.py
shahabou Posted April 18, 2020 Author Posted April 18, 2020 Thanks a lot <3 ...The problem of getting 500 error from python3.7 still, even with copy-paste the shebang line you gave.
shahabou Posted April 18, 2020 Author Posted April 18, 2020 Here man:http://shahabou.heliohost.org/cgi-bin/retry.py And this one with #!/usr/bin/python works fine:http://shahabou.heliohost.org/test.py
Krydos Posted April 18, 2020 Posted April 18, 2020 print "Content-type: text/html\n\n" This is python2 syntax. For python3 you need parenthesis. Change it to: print("Content-type: text/html\n\n") 1
shahabou Posted April 18, 2020 Author Posted April 18, 2020 God I can't believe it!Now, after I read your reply I told myself goddamn how dumb I was; but when I checked the file parentheses are exist, BTW copy-paste the line you gave and it's done!IDK, thanks a lot putting your time on me and for all the amazing thing you offer.With much love to HELIO..:-$
Luigi123 Posted April 18, 2020 Posted April 18, 2020 You’re welcome! Let us know if you need any help.
Recommended Posts