cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
123
Views
0
Helpful
1
Replies

Python ping script in Packet Tracer

Translator
Community Manager
Community Manager

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

1 Reply 1

marce1000
VIP
VIP

 

                - FYI : Community group for Packet Tracer project questions

 M.



-- ' 'Good body every evening' ' this sentence was once spotted on a logo at the entrance of a Weight Watchers Club !
Review Cisco Networking products for a $25 gift card