Re: excel column autofit
Lance Hoffmeyer wrote: > Hey all, > > Wondering why the syntax won't autofit Column A? > I am not getting any errors. > > Also, is there a way of reducing the number of > syntax lines? Basically, I am wondering if there > is an easier way to copy and paste? > > Thanks in Advance. > > Lance > > # ADD ROW LABELS > sh = wb.Worksheets ("Total") > sh.Select() > sh.Range(sh.Cells(2,1), sh.Cells(20,1)).Select() > sh.Range(sh.Cells(2,1), sh.Cells(20,1)).Copy() > sh = wb.Worksheets ("Current Total") > sh.Select() > sh.Range(sh.Cells(2,1),sh.Cells(20,1)).Select() > sh.Paste() > sh.Columns("A:A").EntireColumn.AutoFit > Looks like you just forgot to add the parenthesis after AutoFit sh.Columns("A:A").EntireColumn.AutoFit() Jeff -- http://mail.python.org/mailman/listinfo/python-list
RE: Python + PostgreSQL
Just thought I'd add that I've been using SQLAlchemy + Postgresql w/ psycopg2 driver with great success for a long time now. This is just a preference, but I like using SQLAlchemy without the ORM. It has really good support for basic low level stuff like defining tables, inserts and updates. The big win for me has been the ease of moving apps between different databases. I have had to do this several times, and the process is mostly painless. Jeff -Original Message- From: python-list-bounces+jpeck=fedex@python.org [mailto:python-list-bounces+jpeck=fedex@python.org] On Behalf Of Philip Semanchuk Sent: Tuesday, March 17, 2009 10:24 PM To: python-list (General) Subject: Re: Python + PostgreSQL On Mar 17, 2009, at 10:57 PM, Lobo wrote: > Many thanks to all for your valuable input. > > I've done some research and I believe I will use (at least for now, to > make it simple) psycopg2 module to connect Python to PostgreSQL. > > I am wondering whether I can jump directly to Python 3.x (instead of > using Python 2.6), depending of course on psycopg2 compatibility?. You can, but as you observed you'll be running a patched version of psycopg2. If this is the only extension module library you think you'll need in your project, then running Python 3.x is fine. Otherwise you might run into surprises when you find that there's a lot fewer extensions available for 3.x than for 2.x. That's changing, but it seems to be the state of the Python world today. Case in point -- you said your project is a Web project, yes? Then whatever Web framework you use will need to have been ported to 3.x. At this point, I don't know if any of the major ones have been. I know that as a new user you'd like to start using the latest & greatest version of Python so that you don't put your project in a position where you know you'll have to upgrade at some point in the future, but that's probably your best course of action at the moment. Good luck Philip > I saw in a different post that psycopg2 does work on Python 3.x as > long as a patch is applied (by Martin v. Löwis): > > http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/56b7f ca444a5aa5d/4064a307dca37686?rnum=1&q=python3+postgresql&_done=%2Fgroup%2Fco mp.lang.python%2Fbrowse_frm%2Fthread%2F56b7fca444a5aa5d%2Fc4f74719f6694dce%3 Flnk%3Dgst%26q%3Dpython3%2Bpostgresql%26#doc_29389da8b2b83188 > > Do you know where can I find this patch, and if it does fully solve > any incompatibility issues to be able to use Python 3.x without > problems?. > > Or should I just use Python 2.6?. > > What would you recommend?. > > Many thanks again, > > Carlos > > On Mar 17, 12:20 pm, Philip Semanchuk wrote: >> On Mar 17, 2009, at 12:46 PM, Lobo wrote: >> >>> Hi, >> >>> I am new to this newsgroup (and new to Python and PostgreSQL). My >>> experience (17+ years) has been with Smalltalk (e.g. VAST) and >>> Object >>> databases (e.g. Versant, OmniBase). >> >>> I now have a new project to develop web applications using the >>> latest/ >>> best possible versions of Python (3.x?) with PostgreSQL (8.x?, with >>> pgAdmin 1.10?). >> >>> I hope to get some hints as of what frameworks/modules to use for >>> this >>> specific combination (Python + PostgreSQL)?, should I use django, >>> zope, web2py, psycopg module, others?, what are their pros/cons?. >> >> Hi Carlos, >> You'll find a lot of libraries and projects aren't supporting Python >> 3.x yet. Consider (as others have suggested) working in Python 2.6 to >> ease the transition to 3.x when you & your libs are ready. >> >> I've used Psycopg2 to talk to Postgres from Python and had great >> success with it. >> >> As far as Django versus Zope versus web2py versus Pylons versus >> TurboGears versus... Well, there's enough flamewar material in there >> to power New York for centuries. They've all got their strengths and >> weaknesses. I know which I prefer but my needs and preferences are my >> own and only you know yours. >> >> One thing I will note is that Zope's database is an object hierarchy >> which sounds like a familiar tool for you, so that might ease your >> transition into the Python world. >> >> Good luck >> Philip > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Python 2.6 + Pytz 2009a + Py2exe problem
I've recently upgraded to python 2.6 and I'm having trouble building an executable using the new Pytz package. The relevant section of setup.py is below. This was working under python 2.5 using an ancient version of pytz (2006p). setup( console = [dict(script = my_script.py')], options = dict( py2exe = dict( packages = ['pytz', 'pyodbc', 'decimal', 'sqlalchemy'], typelibs=[('{00020813---C000-0046}', 0, 1, 4)], ))) When I try to run the resulting executable, I get: pytz.UnknownTimeZoneError: 'US/Central' I noticed that the old version of pytz I was using compiled each timezone into a .pyc, and these would be included in the resulting library.zip for my programs. When I build against the new pytz, these files are no longer getting compiled to .pyc. Instead, when I check the pytz directory in library.zip, I see these files: __init__.pyc reference.pyc tzfile.pyc tzinfo.pyc It appears that the zoneinfo directory is missing. I have tried pasting this in manually with no luck. Any ideas? Thanks, Jeff Peck -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I Block Events in wxPython
Philip Semanchuk wrote: On Dec 9, 2009, at 10:42 AM, Wanderer wrote: I have a wxPython program which does some calculations and displays the results. During these calculations if I click the mouse inside the dialog the program locks up. If I leave the dialog alone the process completes fine. I have tried running the function from a separate dialog with Show Modal and I have tried using SetEvtHandlerEnabled all to no avail. The program is long and occupies several files so I won't show the whole thing but here is the calculation part. How do I block events? Hi Wanderer, I don't have a solution for you but I have three suggestions. First, your program shouldn't be locking up just because you clicked on it. IMO that's the real problem, and discarding events is just a band-aid to cover it up. Nevertheless, sometimes a band-aid is an appropriate solution and you're the best judge of that. Second, the wxPython mailing list would be a better place for this question. Third, if you can't seem to resolve the problem, try paring it down to a minimal example that reproduces the problem. It's difficult to offer suggestions when we can't see the whole code or try the sample code ourselves. Good luck Philip Wanderer, I agree with Philip. You probably want your calculation code in a separate thread. I'd advise against this, but if you're just looking for a bandaid you could try creating an event handler to catch the mouse clicks and simply call event.Skip(). If you do this, you might have to introduce a flag that gets set to True only during your calculation, and then your event hander could look something like this: def OnMouseClick(self, event): # Only skip mouse click event if calculating if self.busy: event.Skip() Jeff -- http://mail.python.org/mailman/listinfo/python-list
Re: Bluetooth
On 3/7/2010 1:26 PM, PythonAB wrote: Hello, I'm writing a script that has to connect a bluetooth device with a 3D application. On my search for a bluetooth module i ran into this: http://www.python.org/download/releases/2.4/notes/ where it says: "The socket module now supports Bluetooth sockets, if the system has " Yet I can't find anything at all in the socket manuals nor anywhere else on the site... Does the socket module really support Bluetooth out of the box? I've used socket before but never read anything about bluetooth... Maybe I need to get the bluetooth.h file, but i have no idea what I am supposed to do with it... Can anyone shed some light on this for me please? thanks in advance, gr Arno Have you come across the PyBluez library yet? I recently used it in a project and it worked very well. Hth, Jeff -- http://mail.python.org/mailman/listinfo/python-list