• Register
0 votes

I am new to python programming I was trying to create bot service of twitch but I am totally confused about how to search for ports and hosts. The code I wrote is:


import socket
 def opensocket(socket):

      s = openscoket("irc.twitch.tv", port)

but it gives me error:

  File "main.py", line 2
    def opensocket(socket):
IndentationError: unexpected indent

I used port because I don’t know how to search for serial ports. I also have an error in my code how can I solve this? 

10 7 2
6,060 points

1 Answer

0 votes

You can search in the link for your query:


To get help for your ports use the command line:

python -m serial.tools.list_ports:

And also can use:

import serial.tools.list_ports
COMPORT = serial.tools.list_ports.comports()
connected = []
for things in COMPORT:
print("Your port is: " + str(connected))

Happy coding

11 6 4
34,950 points

Related questions

0 votes
1 answer 71 views
Problem : I am new to MySql. The problem started when I was unable to login to Mysql using my Mysql console. It is repeatedly asking me the password and now I am unable to remember my password. Can I change my password ? And now when I am trying to open my PhpMyAdmin ... WAMP and after that deleted all my related files and then reinstalled it .But it did not fix my issue. How can I fix the issue ?
asked Feb 26 mphil 2.3k points
0 votes
1 answer 19 views
I am new in Python and i am finding an answers at kodlogs where i have to read a line of space separated integers. I am using Python-2.
asked Sep 25 Daniel Anderson 4k points
0 votes
1 answer 14 views
I have a script named requests.py that imports the requests package. The script either can't access attributes from the package, or can't import them. Why isn't this working and how do I fix it? The following code raises an AttributeError. import requests res = ... ", line 1, in <module> from requests.auth import AuthBase ImportError: No module named 'requests.auth'; 'requests' is not a package
asked Oct 25 psandprop 2.4k points
0 votes
1 answer 21 views
I am trying to pip install the MySQL-python package, but I get an ImportError. Jans-MacBook-Pro:~ jan$ /Library/Frameworks/Python.framework/Versions/3.3/bin/pip-3.3 install MySQL-python Downloading/unpacking MySQL-python Running setup.py egg_info for package ... /T/pip-build/MySQL-python Storing complete log in /Users/jan/.pip/pip.log Jans-MacBook-Pro:~ jan$ Any ideas?
asked Oct 24 psandprop 2.4k points
0 votes
2 answers 27 views
1 I am unable to install Python 3.6 on Windows 7 Professional Edition 32 bits the install dialog points me to the log file whose content is as follows: [1398:1318][2018-05-30T01:15:25]i001: Burn v3.10.3.3007, Windows v6.1 (Build 7600: Service Pack 0), ... 1 is required to continue installation How can I solve this error ? Should I install a different version of Windows in order to make this work ?
asked Oct 24 psandprop 2.4k points