run runs away
Hello
I think my question is how to make
the script wait until it returns from a call to run()
Here is a code snippet:
# next lines calls python2.4 32 bit version
# from a script running in python2.3 64 bit version
run("python2.4", "dbviewmaster.py")
# I want the following only to run after
# running of python2.4 has finished
self.textBrowser1.reload
f = open(self.DBMETA,'r')
for self.getline in f.readlines():
self.textBrowser1.append(self.getline)
f.close()
Thanks for any hints how to do that.
Nx
--
http://mail.python.org/mailman/listinfo/python-list
Re: run runs away
Thanks for your reply ! I now realize , that the run() used in this code stems from a def , which actually wraps os.spawnv(os.P_WAIT, ...) in a way that eliminates waiting I like this newsgroup as there are always people who are less stumped than oneself. Nx -- http://mail.python.org/mailman/listinfo/python-list
Python 32 and Python 64 bit
Suse Linux 9.2 64 Python 2.3 64 bit Python 2.4 32 bit My question is : I have a python prog which is installed for python 2.3 but I need some variables filled with data, which I only can get with running a python prog via python 2.4 (data is comming from a firebird database server via kinterbase all needs to be 32 bit). How do I call python 2.4 from within python 2.3 and load my variables with the data from the python 2.4 run ? Nx -- http://mail.python.org/mailman/listinfo/python-list
Need better way to unpack a list
Is there a better solution to following problem : I want to unpack a list into variables the list is created at runtime and I do not know how many items there will be , but I know not more than 25. The list unpacks into variables which are prev. defined as line1,line2line25 which are actually the names of lineedit fields in a Qt gui application and which need to be populated. I currently use following to achieve that : c=0 while c < len(mylinelist): c = c + 1 if c==1: self.line1.setText(mylinelist[c]) if c==2 : self.line2.setText(mylinelist[c]) . . . if c==25: self.line25.setText(mylinelist[c]) I rather have someting like pseudo code follows: self.line+"c"+.setText(mylinelist[c]) How to do that ? Nx -- http://mail.python.org/mailman/listinfo/python-list
Re: Need better way to unpack a list
> for index, value in enumerate(mylinelist): > getattr(self, "line%d" % (index + 1)).setText(value) Thanks ! This was the line which did it The correct code snippet now reads : # set the lineedits of the QT gui for index,value in enumerate(self.mylinelist): getattr(self, "lineEdit%d" % (index + 1)).setText(self.tr(value)) Nx -- http://mail.python.org/mailman/listinfo/python-list
variable hell
Hi I am unpacking a list into variables, for some reason they need to be unpacked into variable names like a0,a1,a2upto aN whatever is in the list. How to create the variables dynamically ? I am looking for something like pseudo code line follows : a%s = str(value) here below is a snippet from the mylist unpack code #next lines cut the end of line character from each line in the list mylist = [line[:-1] for line in mylist] for index,value in enumerate(mylist): if index == 0 : a0 = str(value) print "a0 : ",a0 elif index == 1 : a1 = str(value) print "a1 : ",a1 Thanks Nx -- http://mail.python.org/mailman/listinfo/python-list
Re: variable hell
Thanks for the many replies here is an example for what it will be used for , in this case fixed at 31 fieldvalues: inputvalues=(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25, s26,s27,s28,s29,s30,s31) MYINSERTSELECT = "INSERT INTO ADDRESS(ALIAS,COMPANY,ADDRESSLI1,ADDRESSLI2,ADDRESSCO,TOWN,ZIP,COUNTRY,TEL1,TEL2,FAX,EMAIL,INTERNET,PERSON1,TITLE1,RES1,PERSON2,TITLE2,RES2,PERSON3,TITLE3,RES3,PERSON4,TITLE4,RES4,PERSON5,TITLE5,RES5,PRODALIAS,PAGER,TLX,ADDMEMO) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" con1.commit() cur = con1.cursor() try : cur.execute(MYINSERTSELECT,inputvalues) con1.commit() print 'Inserted 1 record' except IOError, (errno, strerror): print "I/O error(%s): %s" % (errno, strerror) except ValueError: print "Could not convert data to an integer." except: print "Unexpected error:", sys.exc_info()[0] raise I am sure there is an easier way, but I have not found it yet. Nx -- http://mail.python.org/mailman/listinfo/python-list
Re: variable hell
> """ > > Why unpack inputvalues if your next step is to pack'em back again ? Or > what did I miss ? > The original values in this case are being read from a text file with one value including a linefeed per line and the original idea was, that having them read into a list was the best way to massage them into the form required to be used as input values for the insert statement. Nx -- http://mail.python.org/mailman/listinfo/python-list
Re: variable hell
Thanks for all the responses and animated discussion, which is still the best way to learn something new. Most of the time it is not that you want to do something in a certain way , it rather is one cannot think of a better , faster more efficient way . Nx -- http://mail.python.org/mailman/listinfo/python-list
Installation question
I would like to know how to install Qt3 for following setup Already Installed : Suse 9.2 64 version Python 2.3 (for 64) lives in /usr/bin/python2.3 Qt3 (for Python 2.3) Python 2.4 (for 32) lives in /usr/local/bin/python2.4 Want to install Qt3 (for Python 2.4) without messing up my existing installation. Thanks Nx -- http://mail.python.org/mailman/listinfo/python-list
Re: Installation question
Thanks anyway I wished there was a sure step by step approach to get it to work but I can't think of any good solution and I do not want to reinstall a well optimized system if something goes astray. Nx -- http://mail.python.org/mailman/listinfo/python-list
