def readmqmessage(req):
print req.get_full_path()
print req.GET['queue']
qname=req.GET['queue']
output=commands.getstatusoutput("/home/mqm/sbin/read_mq_message QMEMBFE 'SYSTEM.ADMIN.SVRCONN' '10.3.244.1' '1417' %s" % qname)
aa={'response':output}
return HttpResponse(json.dumps(aa), content_type="application/json")
def getmqmessage(req):
print req.get_full_path()
print req.GET['queue']
qname=req.GET['queue']
output=commands.getstatusoutput("/home/mqm/sbin/get_mq_message QMEMBFE 'SYSTEM.ADMIN.SVRCONN' '10.3.244.1' '1417' %s" % qname)
aa={'response':output}
return HttpResponse(json.dumps(aa), content_type="application/json")
node2:/root/python#cat a7.py
import commands
str='测试'
aa= commands.getstatusoutput("echo %s >>aa.txt" % str)
print type(aa)
print aa
node2:/root/python#cat aa.txt
cat: aa.txt: No such file or directory
node2:/root/python#python a7.py
File "a7.py", line 2
SyntaxError: Non-ASCII character 'xe6' in file a7.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
node2:/root/python#cat a7.py
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import commands
str='测试'
aa= commands.getstatusoutput("echo %s >>aa.txt" % str)
print type(aa)
print aa
node2:/root/python#python a7.py
<type 'tuple'>
(0, '')
node2:/root/python#cat aa.txt
测试