-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfileread.py
More file actions
34 lines (27 loc) · 791 Bytes
/
fileread.py
File metadata and controls
34 lines (27 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import sys
import base64
# to check if the file is exist or not
File = "test.txt"
pa = os.path.dirname(os.path.realpath(__file__))
print "The directory is :", pa
execfile("filewrite.py")
try:
if os.stat(pa+ "\\" + File).st_size > 0:
print "Processing..."
with open(File, "rb") as myfile:
pickmsg = myfile.read()
work = pickmsg.split()
done = []
for i in range(0, len(work)):
msg = base64.b64decode(work[i])
done.append(msg)
print done
else:
print "Empty URL file ... exiting"
sys.exit()
except OSError:
print "URL file missing ... exiting"
sys.exit()
# to get the current path of the script
# os.path.realpath(__file__)