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 :
error :
i need to call this variable ( filename )from function qassam() inside another fileex() ..
this is my code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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: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