Python ping script in Packet Tracer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024
02:09 PM
- last edited on
04-11-2024
03:34 PM
by
Jimena Saez
Hello,
I'm looking to automate ping in packet tracer with Python. I made a script that works on PC Windows but not in PT. Error msg: AttributeError: '<invalid type>' object has no attribute 'system' in file Ping-PY.py on line 4
here is my script:
import os
def myping(host):
response = os.system("ping" + host)
if response == 0:
return True
else:
return False
print(myping("127.0.0.1"))
print("192.168.1.153")
print("192.168.3.50")
print(myping("192.168.4.115")
print("192.168.5.83")
print("192.168.5.227")
print("192.168.2.48")
print("192.168.2.67")
print(myping("192.168.5.252")
print("203.0.113.27")
I tried other scripts but without success! Is there a doc on how to use Python in Packet Tracer?
Thank you in advance
- Labels:
-
Switching
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 11:24 PM
- FYI : Community group for Packet Tracer project questions
M.
-- Each morning when I wake up and look into the mirror I always say ' Why am I so brilliant ? '
When the mirror will then always repond to me with ' The only thing that exceeds your brilliance is your beauty! '
