• Register
0 votes
26 views

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

Please log in or register to answer this question.

1 Answer

0 votes

You can search in the link for your query:

https://pyserial.readthedocs.io/en/latest/tools.html

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:
    connected.append(things.device)
print("Your port is: " + str(connected))

Happy coding

11 6 4
34,950 points

Related questions

0 votes
1 answer 4 views
4 views
Problem: i need some help about this problem? ubuntu see what ports are in use
asked Apr 12 Rohit kr 17.5k points
0 votes
1 answer 15 views
15 views
Problem: I'm running a Centos virtual machine using Vagrant. The machine seems to run properly, but when I try to sync Perforce I can see the following error: Surname not supported for ai_socktype Any hints?
asked Mar 24 ummesalma 29.2k points
0 votes
1 answer 106 views
106 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, 2020 mphil 2.3k points
0 votes
1 answer 4 views
4 views
Problem: How can you find out which process is listening on a TCP or UDP port on Windows?
asked 4 days ago sumaiya simi 43.9k points
0 votes
1 answer 6 views
6 views
Problem: I have a port that may be closed by a firewall. Is there a way to ping out or in, on a specific port, to see if it is open?
asked Apr 3 Jack20 5.1k points
0 votes
1 answer 5 views
5 views
Problem: I am stuck during learning as I have already mentioned in my question someone please cooperate me to continue my project-Thanks
asked Mar 24 rubelkhan 20.4k points
0 votes
1 answer 3 views
3 views
Problem: i need some about this problem please help? how to check port 8080 is open
asked Mar 22 Rohit kr 17.5k points
0 votes
1 answer 6 views
6 views
Problem: I install Mysql server in my pc to practice j2ee and after some days i uninstalled it and installed xampp for PHP development but it is showing port not free error. I already try using cmd and deleting the mysql files in c drive but no use still my xampp is saying ... 11:08:46 AM [mysql] Expected Path: c:\xampp\new1\mysql\bin\mysqld.exe --defaults-file=c:\xampp\new1\mysql\bin\my.ini mysql
asked Apr 24 Humaira ahmed 50.7k points
0 votes
1 answer 5 views
5 views
Problem: I'm having trouble finding a solution; could you please assist me? “Port 80 in use by unable to open process with pid 4 windows 10”.
asked Apr 1 rakib1 51.5k points
0 votes
1 answer 3 views
3 views
Problem: When I encountered this problem, I attempted to find a solution on the internet but was unable to find any useful details. If you read the above query and understand what the solution is, please cooperate with me- Thanks.
asked Apr 1 rakib1 51.5k points