[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A mask to use xwpe with Python
Marcelo Nunes sent me information on running python scripts from xwpe.
Looks like it could be adapted to other languages easily enough. You
would have to have python to run it.
> Im writing to send you a mask I made to use the RUN option of xwpe to
> execute and test my Python scripts directly. Its a little stupid, but it
> makes Python interpreter to behave like a GNU compiler...and it works
> well!!
>
> To use it, just use this script as the compiler. it woll automatically
> generates .o and .e file that are used by xwpe.
>
> Greedings,
> Marcelo
#!/usr/bin/python
import os
import sys
print '''pymask - A mask program that make the python interpreter to behave
like a GNU compiler. Suitable for use with XWPE.
Copyright (c) 1999, by Marcelo P. Nunes <mpn@acm.org>
'''
if (sys.argv[1] == '-c') and (sys.argv[3] == '-o'):
print 'Writing file', sys.argv[4],'...',
f = open (sys.argv[4],'w')
f.write (sys.argv[2])
f.close()
print 'done.'
elif (sys.argv[1] == '-o'):
print 'Writing file', sys.argv[2],'...',
f = open (sys.argv[3])
arg = f.read()
f.close()
f = open (sys.argv[2],'w')
f.write ('python -i ' + arg + '\n')
f.close()
os.system('chmod +x ' + sys.argv[2])
print 'done.'
else:
print 'ERROR -- ERROR -- ERROR'
print "You made a mistake, try using the Python interpreter instead."