changed touch by open('blabla','w') and close, because touche sometimes returns -1

上级 7d104730
...@@ -46,9 +46,13 @@ def compile_dir(): ...@@ -46,9 +46,13 @@ def compile_dir():
if not os.access(cachedir, os.R_OK | os.W_OK): if not os.access(cachedir, os.R_OK | os.W_OK):
os.makedirs(cachedir, 7<<6) #read-write-execute for this user only os.makedirs(cachedir, 7<<6) #read-write-execute for this user only
cachedir_init = cachedir+'/__init__.py' cachedir_init = cachedir+'/__init__.py'
touch = os.system('touch '+cachedir_init) # PROBLEM: sometimes touch returns -1 for no reason, the simple hack below
if touch: # solved the problem, but weird...
raise OSError('touch %s returned %i' % (cachedir_init, touch)) #touch = os.system('touch '+cachedir_init)
#if touch :
#raise OSError('touch %s returned %i' % (cachedir_init, touch))
hack = open(cachedir_init,'w')
hack.close()
if cachedir not in sys.path: if cachedir not in sys.path:
sys.path.append(cachedir) sys.path.append(cachedir)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论