Open Pratham04 opened 4 years ago
im also getting this problem:
Traceback (most recent call last):
File "listen.py", line 6, in
I am also getting this error
@Pratham04 you installed the wrong pip package, install this one instead: https://pypi.org/project/python-decouple/
Decouple package from pip3 won't work, try installing python-decouple, for this script. For uninstalling decouple: pip3 uninstall decouple For installing python-decouple: pip3 install python-decouple
@amnotyourbae you will have to define the variables IP_NETWORK and IP_NETWORK in your .env file. Something line : IP_NETWORK = 192.168.54.255 IP_NETWORK = 192.168.54.65
Of course, the IP address will depend on your personal network. For a more comprehensive idea have a look at this script that I made: https://github.com/kartikeytewari/Netscanning
hello. How do we import the variables from the .env file? Is there a command?
No need, python will read from variables from .env file by itself. There is no need for different configurations.
thank you. that one is ok but I am finding very difficult to list all the IPs. I found the code below but for some reason it doesn't seem to list everything and I don't understand why. When I am logging into the router, there are several Android devices and smart plugs which are not listed with the code. I have been searching youtube and google for some time now but I haven't found it yet :( .
import os devices = [] for device in os.popen('arp -a'): devices.append(device)
for device in devices: print(device)
No need for the above code, your .env file should only have the variables. Getting your device IP (allocated by the router) should be possible by logging to your particular router, and accessing the information from there. The allocated IP can also be found in your particular device's settings.
Guys how do you get / find the .env file???
you will have to make the .env file yourself!
@kartikeytewari I have no idea how you are able to get all your devices by pinging router. I've tried it both on my windows and linux machines and it always returns only IP the same device I was pinging in this case my router.
@Dzionys imo, your .env file might not be working properly. Share your .env file. I can then tell, if there is some issue with it. Also, I have made a better script that generated the ".env" file for yourself. To use that check out: https://github.com/kartikeytewari/Netscanning . Also, I in the .env file write your "local ip" not "public ip". For example to get local ip, in macos use the command: ipconfig getifaddr en0
Bro in this project
import sys import subprocess import os from decouple import config
IP_NETWORK = config('IP_NETWORK') IP_DEVICE = config('IP_DEVICE')
I am getting this problrm:- from decouple import config ImportError: cannot import name 'config' from 'decouple' (C:\Python\python38-39\lib\site-packages\decouple__init__.py)