Re: Newbie
For me (I am newbie as well) was following link very useful: http://benyoonline.com/pqr/PQR2.4.html Good luck with Python Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: Dealing with Excel
Robert Sorry I was not more clear in my posting. I am solving similar problem as you are. 1) I am getting my data from the Firebird SQL database - directly, using SQL commands (kinterbasdb module), not using ODBC, or ADODB or what ever - some people here can suggest you how to connect directly to the Oracle. 2) In the Python code, I am processing data I have got from the Firebird (I have data stored in the two dimensional list usually) 3) I am setting up the Excel cell range according to the final size of data using Visual Basic for Applications commands for example: rng=xlApp.Range(xlApp.Cells(1,1),xlApp.Cells(len(rw),len(rw[0]))) 4) I am putting data from the Python to the Excel rng.Value=rw 5) I am formatting the data in the Excel worksheet using the VBA code from the Python code and finally I can save it, (it is possible get Excel under the full control from the Python). That's it! I am just a newbie in the Python, so I somebody here can show you different (better) way to go, but above mentioned works for me great. If you are looking for the way how to create (generate) the Excel file directly from the Python, I didn't find it. The only simple way I have found in this discussion group is to save your data separated by semicolons in the file with the .csv extension. Excel will recognize it as an Excel file and open it without problems. Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: Dealing with Excel
Robert Hicks wrote: > I need to pull data out of Oracle and stuff it into an Excel > spreadsheet. What modules have you used to interface with Excel and > would you recommend it? It is possible to control Excel directly from the Python code (you do not need to write Excel macros within the Excel). It works flawlessly for me. My code goes for example: import win32api from win32com.client import Dispatch xlApp = Dispatch("Excel.Application") xlApp.Visible=0 xlApp.Workbooks.Add() . . === snip === It is helpful to find values of VBA (Visual Basic for Applications) constants on the Internet or in the Excel documentation and this constants values assign as Python constants with the same names as in VBA in the code. For example: xlToLeft = 1 xlToRight = 2 xlUp = 3 xlDown = 4 xlThick = 4 xlThin = 2 xlEdgeBottom=9 Than you can use exactly the same code as in your Excel macros (including formating etc.). === snip === xlApp.Range(xlApp.Selection, xlApp.Selection.End(xlToRight)).Select() xlApp.Range(xlApp.Selection, xlApp.Selection.End(xlDown)).Select() xlApp.Selection.NumberFormat = "# ##0" xlApp.Selection.HorizontalAlignment = xlRight xlApp.Selection.IndentLevel = 1 === snip === HTH Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: Example of signaling and creating a python daemon
--snip-- > I have no experience daemonizing a script so this help would be much > appreciated. I have found a couple of scripts googling on creating a > deemon but not work in this way. > > Regards, > David Hi, maybe this two link can help: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731 Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: micro-python - is it possible?
Check Lua programing language. Maybe this can fit your requirements. HTH Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: time.mktime problem
according to the Python documentation: http://docs.python.org/lib/module-time.html ===snip=== Values 100-1899 are always illegal. . . strptime(string[, format]) . . The default values used to fill in any missing data are: (1900, 1, 1, 0, 0, 0, 0, 1, -1) ===snip=== BTW, check the following code: >>import datetime, time >>print time.gmtime(time.mktime((1900, 1, 1, 0, 0, 0, 0, 1, -1))) (1901, 12, 13, 20, 45, 52, 4, 347, 0) but (1900, 1, 1, 0, 0, 0, 0, 1, -1) is (IMHO) expected Hmmm. But I am just a newbie!!! :) Anyway, maybe I am just using a wrong way how to calculate time delta between two time values given in the format "HHMMSS". Does Python provide some other ways how to calculate it? Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
time.mktime problem
Hi, on Linux (Fedora FC4) and Python 2.4.1 I am trying to know the time delta in seconds between two times given in the HHMMSS format. My code looks like: import datetime, time ta1=(time.strptime('01', '%H%M%S')) ta2=(time.strptime('230344', '%H%M%S')) t1=time.mktime(ta1) t2=time.mktime(ta2) print t1, t2 -2147483648.0 -2147483648.0 I just can not figure out, why the t1 and t2 are the same? Thanks for your comments Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: py-serial + CSV
Thanks you all, guys, for your suggestions and help. Everything now works great :) Regards Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: py-serial + CSV
Sergei, I do not realy understand your comment??? Am I missing something? BTW, is there some possibility to address lists like: print words [1; 3; 5] instead of print words[1], words[3], words[5] Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: py-serial + CSV
Sorry, I did not mentioned the data flow from the serial port is permanent/continuous (as long as the GPS receiver is connected to the serial port). The input data are commning every second, they are comma separated and they are looking like: $GPGGA,174525.617,5026.1080,N,01521.6724,E,1,05,1.8,306.5,M*0B $GPGSA,A,3,02,09,05,06,143.6,1.8,3.1*31 $GPGSV,3,1,09,30,74,294,,05,65,093,49,06,40,223,32,02,39,089,49*78 $GPRMC,174525.617,A,5026.1080,N,01521.6724,E,0.0,005.8,230805,,*0A etc >From the rows they are begining with $GPRMC I want to get following data only (positions 2,4,6) 174525.617 5026.1080 01521.672 This (according to your suggestions) is my code which works for me import serial s = serial.Serial(port=0,baudrate=4800, timeout=20) while 1: line = s.readline() words = line.split(',') if words[0]=="$GPRMC": print words[1], words[3], words[5] I just wonder if there is some beter (or as you are saying "more pythonic":) aproach how to write such a piece of code. -- Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: py-serial + CSV
So do I have to save to the file first and analyze later on? Or there is an other way how to process it (read from the serial and analyze data) on the fly? Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
py-serial + CSV
Hi I am just trying to analyze (parse) data from the serial port (I have connected GPS receiver to the ttyS0, so I can read ASCII characters in the CSV form on the serial port 1). I am doing this just to understand how Python works (yes, you can call me Python/Linux newbie :) My environment is Fedora Core 4, Python 2.4.1 CSV alone (to read CSV data from the file) and py-serial alone (to read data from the serial port) are working flawlessly. Even I was trying to google through this group and through the Internet, I am not able to read (and parse) CSV data directly from the serial port. data from my serial port (using py-serial) I am getting this way: >>> import serial >>> s = serial.Serial(port=0,baudrate=4800, timeout=20) >>> s.readline() '$GPRMC,101236.331,A,5026.1018,N,01521.6653,E,0.0,328.1,230805,,*09\r\n' my next intention was to do something like this: import csv r = csv.reader(s.readline()) for currentline in r: if currentline[0] == '$GPRMC': print currentline[2] print currentline[4] but it does not work Thanks for your comments Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: Point and click GUI builder for Python
Don't forget Eric3 + PyQt + Qt designer? I think they are great tools. -- http://mail.python.org/mailman/listinfo/python-list
Re: subprocess.call(*args **kwargs) on Linux
Thanks a lot :) Petr -- http://mail.python.org/mailman/listinfo/python-list
subprocess.call(*args **kwargs) on Linux
Hi all, I am trying to use subprocess module on Linux/Python-2.4.1, but I can't dig throught. I need to call executable which needs two parameters to be ginven (the serial port and the file name). It looks like /root/dex/dex /dev/ttyS0 blabla.txt in the shell. This is easy. Subprocess function "call" looks: returncode = subprocess.call(["/root/dex/dex","/dev/ttyS0", "blabla.txt"]) and it runs smoothly. The problem starts when I am trying to add 1>/dev/null 2>/dev/null parameters to suppres output sendings. In the Shell it looks like: /root/dex/dex /dev/ttyS0 blabla.txt 1>/dev/null 2>/dev/null I am not able to find the propper "call" syntax to do this. Any suggestions? Thanks a lot. Petr -- http://mail.python.org/mailman/listinfo/python-list
Re: New WYSIWYG Python IDE in the works
sorry for bothering you with my comment. From my point of view, the situation on the IDE (GUI??) development field for Python is really strange. Just try to imagine the same situation around the Python. Plenty of different approaches, versions, philosophies etc. Why people they really know the ways how to develop really good, prime and functional SW (I mean different developers of IDEs) do not do it together as a team (like in Python)? It is really strange to me? May be I am missing something (I am a Python newbie), but the way to the Eric3 was really painful to me. Petr -- http://mail.python.org/mailman/listinfo/python-list
Re: just learning eric ide
Try this: http://www.pycs.net/lateral/stories/16.html HTH Petr -- http://mail.python.org/mailman/listinfo/python-list
Re: how to operate the excel by python?
> i want to compare the content in excel,but i don't know whick module to use! > can you help me? Read "Python programming on Win32" book, use win32api module. According to Chad's advices about Excel (VBA) constants, you can find following link usefull as well. http://fox.wikis.com/wc.dll?Wiki~ExcelConstants~VFP HTH Petr -- http://mail.python.org/mailman/listinfo/python-list
Olympus R1000 Linux, Qtopia, PyQt and Python
Is here anybody who has practical experiences with programing Olympus R1000 hand-held (Linux OS) using Qtopia, PyQt and Python? If yes, can you share your experiences? I am intending to use this platform, but I would like to know if the device is mature enough and if Qtopia, PyQt and Python works smoothly on this device. Sorry if this is an off-topic posting but I do not know where somewhere else to ask. Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: Fuzzy matching of postal addresses
Sorry for my "Ferbl typo". For the local anti-smoking campaign I am trying to link some addresses which contain following "linkable" informations (data fields) only: RECORD_ID, Street + No., City, Post code, All data are now w/o Unicode characters. Do you think it possible to try to link it with Febrl w/o deep code modification? I did try to link our data but the result is just a plenty of warning messages but no links. What is your suggestion? Please understand I do not want to bother you with my questions. I am just asking you your comments or pointers before I will try to dig in to the code. You probably know some "tricks" in data organization or something like that, which can be much easier then code digging. I can send our CSVs to you (they are small, just about 3204 records in the A data-set and about 1241 records in the B data-set) and a log as well. I have tried to organized oru files as following: FEBRL reqirements : Our data == 'rec_id': RECORD_ID, 'given_name': "" 'surname': "" 'street_num': "" 'address_part_1': "" 'address_part_2': Street + No. 'suburb': City 'postcode': Post code 'state': "" 'date_of_birth': "" 'soc_sec_id': "" Thanks for your answer and suggestions Petr -- http://mail.python.org/mailman/listinfo/python-list
Re: Fuzzy matching of postal addresses
Tim, do you think Ferbel can parse properly with non English data-sets? I mean do you think it will work properly with data they include non English characters as well? As we live in Europe, we have to solve such a problems here : If the software needs some changes, I am ready, according to your suggestions, to try to do it. Regards Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: Considering python - have a few questions.
Sorry, I have forgotten to mention binding for Firebird to Python: kinterbasdb http://kinterbasdb.sourceforge.net/ Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: Considering python - have a few questions.
I am trying to find answers to the similar problem for nearly two months. After this time it looks for me like this: language: Python 2.3 or 2.4 IDE: Eric3 GUI toolkit: Qt (commercial but free under GPL for Linux and Mac) http://www.trolltech.com/products/qt/index.html (version 4 will be released soon according their web and will be released for free as well (GPL) http://www.trolltech.com/newsroom/announcements/0192.html binding for Python to Qt: PyQt http://www.riverbankcomputing.co.uk/pyqt/index.php Database: Firebird 1.5 Some guys here are talking good about and Boa as well, but I would like to prefer some professional solution. All of course IMHO :)) HTH Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list
Re: how to generate SQL SELECT pivot table string
Tahnks a lot. Michalels sequence works flawlessly. And it is really elegant :) John Machin wrote: >A few quick silly questions: >Have you read the Python tutorial? >Do you read this newsgroup (other than answers to your own questions)? >Could you have done this yourself in a language other than Python? Of course I have read (or still reading) Python tuorial and newsgroup (No kidding:). And I am able to done this in VBA for example. But I am not able to write such a elegant construction. Tanks a lot. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to generate SQL SELECT pivot table string
Thanks for your comment but I am NOT looking for the answer to the question: "Which SQL command will return requested pivot table"(anyway it will be an OFF TOPIC question here). My SQL SELECT statement works fine with Firebird 1.5! What I am looking how to generate this SELECT using Python. Anyway thanks for tyring to help :) -- http://mail.python.org/mailman/listinfo/python-list
how to generate SQL SELECT pivot table string
Hallo all, I am trying to generate SQL SELECT command which will return pivot table. The number of column in the pivot table depends on the data stored in the database. It means I do not know in advance how many columns the pivot table will have. For example I will test the database as following: SELECT DISTINCT T1.YEAR FROM T1 The SELECT command will return: 2002 2003 2004 2005 So I would like to construct following select: select T1.WEEK, SUM (case T1.YEAR when '2002' then T1.PRICE else 0 END) Y_02, SUM (case T1.YEAR when '2003' then T1.PRICE else 0 END) Y_03, SUM (case T1.YEAR when '2004' then T1.PRICE else 0 END) Y_04, SUM (case T1.YEAR when '2005' then T1.PRICE else 0 END) Y_05 from T1 group by T1.week which will return pivot table with 5 columns: WEEK, Y_02, Y_03, Y_04, Y_05, but if the command "SELECT DISTINCT T1.YEAR FROM T1" returns: 2003 2004 I have to construct only following string: select T1.WEEK, SUM (case T1.YEAR when '2003' then T1.PRICE else 0 END) Y_03, SUM (case T1.YEAR when '2004' then T1.PRICE else 0 END) Y_04, from T1 group by T1.week which will return pivot table with 3 columns: WEEK, Y_03, Y_04 Can anyone help and give me a hand or just direct me, how to write a code which will generate SELECT string depending on the data stored in the database as I described? Thanks Petr McBooCzech -- http://mail.python.org/mailman/listinfo/python-list
Re: script to automate GUI application (newbie)
Try following scripting language to automating Windows GUI, it simulates keystrokes (supports most keyboard layouts), simulates mouse movements and clicks and does tons of other stuff: http://www.hiddensoft.com/autoit3/ It works nicely for me. -- http://mail.python.org/mailman/listinfo/python-list
Re: Old Paranoia Game in Python
Newbie in Python. I did copy the whole script form the web and save it as para1.py. I did download pyparsing module and save it to C:\\Python23\\Lib\\pyparsing122. I did run following script: import sys sys.path.append('C:\\Python23\\Lib\\pyparsing122') from pyparsing import * extraLineBreak = White(" ",exact=1) + LineEnd().suppress() text = file("Para1.py").read() newtext = extraLineBreak.transformString(text) file("para2.py","w").write(newtext) I did try to run para2.py script, but following message File "para2.py", line 169 choose(4,"You give your correct clearance",5,"You lie and claim ^ SyntaxError: EOL while scanning single-quoted string So my questions are: Why pyparser didn't correct the script? What I am doing wrong? Is it necessary to correct the script by hand anyway? Petr -- http://mail.python.org/mailman/listinfo/python-list
Re: Best GUI for small-scale accounting app?
Sorry to bother, but I didn't find the final answer to the question what is the "Best GUI for small-scale accounting app"? I am the newbie in Python, so I am trying to find some "usable" GUI as well. But it looks to me there is a lot developers, beta-versions, tools etc. I have spent a lot of time trying to find which is the "best" one tool. But now it looks more confusing to me than at the beginning. I do not have time to try/test all of them, it is so time-consuming and confusing specially for total beginner. IMHO this is the worst think for the Python community: you can find one Python only with an excellent support. Great But on the other hand it is possible to find plenty of GUI tools and for the beginner (and may be not just for the beginner) it is so hard to choose the "proper" one! The field of GUI tools is so fragmented that I am close to give it up and start with some commercial product like Delphi/Kilyx. BTW you did not discussed Boa, Wingware and BlackAdde (last two are commercial) here? Are they bad? Petr -- http://mail.python.org/mailman/listinfo/python-list
sources for DOS-16bit
Hi all, before I decided to bother you by e-mail, I spent days (not kidding) searching on the Internet. I am looking for Python binaries for DOS-16bit Not for Win-16bit or DOS-32 which are the only DOS availabele sources on Python official site and on the other sites as well!!! I will prefere sources for Borland C 3.x. I was trying to use Python 1.0.1 (16python.exe file) for my application, but I realized it doesn't work on NEC V25 CPU (8086/8088 compatible CPU developed by NEC). I was involved in to our school computer "research" :) and we need this piece of code to reach our goal. We have to demonstrate the power of the free software (mainly its compatiblity for different platforms)!!! Can you please search your archives or route me somewhere? I will really appreciate your answer and help Petr Jakes Gymnasium student Jicin Czech republic -- http://mail.python.org/mailman/listinfo/python-list