Sep-16-2018, 09:22 AM
hello all ...
i need to call this variable ( filename )from function qassam() inside another fileex() ..
this is my code :
i need to call this variable ( filename )from function qassam() inside another fileex() ..
this is my code :
import os def qassam(): filename = "/root/Downloads/scapy.txt" #return filename def fileex(): filename = qassam if os.path.isfile(filename): print("is there") else: print("else ... ") fileex()error :
Error:Traceback (most recent call last):
File "/tmp/ArpScanner/arp.py", line 15, in <module>
fileex()
File "/tmp/ArpScanner/arp.py", line 10, in fileex
if os.path.isfile(filename):
File "/usr/lib/python2.7/genericpath.py", line 37, in isfile
st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, function found