Jump to content

Recommended Posts

Posted (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-bot

also to kill two birds with one stone, currently I added 

#!/usr/bin/python

at 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.7

note 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 by shahabou
Posted

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")
  • Like 1
Posted

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..:-$

Guest
This topic is now closed to further replies.
×
×
  • Create New...