Форум сайта python.su
listPresciptFont=[]
listPresciptValue=[]
listPresciptSize=[]
listPresciptAlignment=[]
listPresciptBackgroundColour=[]
for row in range(gridPresc.GetNumberRows()):
for col in range(gridPresc.GetNumberCols()):
listPresciptFont.append(gridPresc.GetCellFont(row,col))
listPresciptValue.append(gridPresc.GetCellValue(row,col))
listPresciptSize.append(gridPresc.GetCellSize(row,col))
listPresciptAlignment.append(gridPresc.GetCellAlignment(row,col))
listPresciptBackgroundColour.append(gridPresc.GetCellBackgroundColour(row,col))
prescFont=pickle.dumps(listPresciptFont)
prescValue=pickle.dumps(listPresciptValue)
prescSize=pickle.dumps(listPresciptSize)
prescAlignment=pickle.dumps(listPresciptAlignment)
prescBackgroundColour=pickle.dumps(listPresciptBackgroundColour)
tuplePrescription=(dateP.GetValue(),
timeP.GetValue(),
surnameP.GetValue(),
nameP.GetValue(),
forenameP.GetValue(),
numberId.GetValue(),
dateBorn.GetValue(),
gender.GetValue(),
diagnos.GetValue(),
prescFont,
prescValue,
prescSize,
prescAlignment,
prescBackgroundColour)
listPrescription=[]
listPrescription.append(tuplePrescription)
for i in listPrescription:
cursor.execute("INSERT INTO prescription VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)",i)
self.data_Patient.commit()
cursor.close()
#worker.py
from PyQt4 import QtCore
import threading
from queue import Queue
class Worker(QtCore.QThread):
def __init__(self):
QtCore.QThread.__init__(self)
def run(self):
print("Started.")
self.doPrint()
print("Finished!")
def doPrint(self):
threads_count = 10
tQueue = Queue()
for num in range(100):
tQueue.put(num)
for i in range(threads_count):
t = threading.Thread(target=self.multiThreading, args=(num, tQueue))
t.start()
time.sleep(0.1)
def multiThreading(self, num, tQueue):
while True:
try:
num = tQueue.get_nowait()
except Exception:
break
print(num)
tQueue.task_done()
import getpass
getpass.getuser()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "vkp.py", line 32, in get_url
return html5lib.parse(t, treebuilder = "lxml", namespaceHTMLElements = False), t
File "/usr/lib/pymodules/python2.6/html5lib/html5parser.py", line 38, in parse
return p.parse(doc, encoding=encoding)
File "/usr/lib/pymodules/python2.6/html5lib/html5parser.py", line 211, in parse
parseMeta=parseMeta, useChardet=useChardet)
File "/usr/lib/pymodules/python2.6/html5lib/html5parser.py", line 111, in _parse
self.mainLoop()
File "/usr/lib/pymodules/python2.6/html5lib/html5parser.py", line 179, in mainLoop
self.phase.processStartTag(token)
File "/usr/lib/pymodules/python2.6/html5lib/html5parser.py", line 447, in processStartTag
self.startTagHandler[token["name"]](token)
File "/usr/lib/pymodules/python2.6/html5lib/html5parser.py", line 447, in processStartTag
self.startTagHandler[token["name"]](token)
File "/usr/lib/pymodules/python2.6/html5lib/html5parser.py", line 1050, in startTagA
self.addFormattingElement(token)
File "/usr/lib/pymodules/python2.6/html5lib/html5parser.py", line 918, in addFormattingElement
self.tree.insertElement(token)
File "/usr/lib/pymodules/python2.6/html5lib/treebuilders/_base.py", line 259, in insertElementNormal
element.attributes = token["data"]
File "/usr/lib/pymodules/python2.6/html5lib/treebuilders/etree_lxml.py", line 219, in _setAttributes
self._attributes = Attributes(self, attributes)
File "/usr/lib/pymodules/python2.6/html5lib/treebuilders/etree_lxml.py", line 189, in __init__
self._element._element.attrib[name] = value
File "lxml.etree.pyx", line 1945, in lxml.etree._Attrib.__setitem__ (src/lxml/lxml.etree.c:42933)
File "apihelpers.pxi", line 488, in lxml.etree._setAttributeValue (src/lxml/lxml.etree.c:13918)
File "apihelpers.pxi", line 1295, in lxml.etree._utf8 (src/lxml/lxml.etree.c:20212)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes
Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]