Re: Adding thread module support to Ubuntu 3 for Python3
On Mon, 23 Jun 2014 19:40:24 -0700, Larry Hudson wrote: > On 06/23/2014 01:12 PM, kenak...@gmail.com wrote: >> What package do I need to install to get thread support (import thread) >> for Python 3 running under ubuntu 3? >> >> > Just curious... Ubuntu 3 -- Are you really running a version that old, > or is that a typo? Current version is 14.04 must be a typo, the first release of unbuntu was 4.10 (numbering is Year.Month) > > OT and FWIW: I gave up on Ubuntu when they switched to Unity -- I find > that very awkward to use. Just personal opinion, of course, and I know > there are others who like it -- that's fine with me as well. (But I > switched to Mint.) > > -=- Larry -=- -- You possess a mind not merely twisted, but actually sprained. -- https://mail.python.org/mailman/listinfo/python-list
What is the state of MySQL support for Python 3?
Good day, I'm starting a new project from scratch so I think its finally a time to switch to the latest and greatest Python 3.4. But I'm puzzled with MySQL support for Python 3. So far the only stable library I've found it pymysql. All others are either abandoned work-in-progress projects or do not support Python 3: * mysqldb - Python 2.x only * mysql-ctypes - Python 2.x only * amysql - Python 2.x only * ultramysql - Python 2.x only * MySQL Connector/Python - new guy in block. Does anyone use it? * WebScaleSQL + MySQLdb1 [1] - still in development, state unknown? * etc... So what library do you use for MySQL access in Python 3? I'm specifically interested in async support (like in psycopg2 for PostgreSQL) since I'm planning to use Tornado. Thanks, Zaar [1] https://github.com/farcepest/MySQLdb1 https://code.facebook.com/posts/1474977139392436/webscalesql-a-collaboration-to-build-upon-the-mysql-upstream/ http://www.percona.com/live/mysql-conference-2014/sessions/asynchronous-mysql-how-facebook-queries-databases -- https://mail.python.org/mailman/listinfo/python-list
Format String: Only when value supplied
Hello, I have a format string like: print "{:10} {:25} = {:6} ({})".format(mod, name, value, description) description can be None. In this case I want to print an empty string (which can be achieved by replacing it with 'description or ""') and I want to omit the brackets. Is there a way to tell the format string to omit a part if an input variable is None? Another question: value can be bool. When I format value with just {} if prints True or False, when I use {:6} it prints 1 or 0. Is there a way to get pack to True / False? Thanks! Florian -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the state of MySQL support for Python 3?
On 2014-06-24, haiz...@gmail.com wrote: > I'm starting a new project from scratch so I think its finally a time > to switch to the latest and greatest Python 3.4. > > But I'm puzzled with MySQL support for Python 3. So far the only > stable library I've found it pymysql. > > All others are either abandoned work-in-progress projects or do not > support Python 3: > * mysqldb - Python 2.x only > * mysql-ctypes - Python 2.x only > * amysql - Python 2.x only > * ultramysql - Python 2.x only > * MySQL Connector/Python - new guy in block. Does anyone use it? Yes. It comes directly from MySQL and is written in pure Python. For that it may not be the fastest solution but it works. Tested with Python 3.2 Bernd -- no time toulouse -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the state of MySQL support for Python 3?
On Tue, Jun 24, 2014 at 6:21 PM, wrote: > I'm starting a new project from scratch so I think its finally a time to > switch to the latest and greatest Python 3.4. > > But I'm puzzled with MySQL support for Python 3. Is it completely from scratch? Can you just use PostgreSQL? It's *so* much better... Sorry, I can't advise on MySQL bindings. Haven't used any of the modules in three parts of forever. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
OPENPYXL
OPENPYXL_problem. Hello, i design a gui using wxpython! I want to read and edit excel files so i use the openpyxl library! But i want to delete specific columns and rows and i cant do it. In addition i want to sort columns by cell color and i cant do that either! Do you have any ideas? Thank you in advance Chris -- https://mail.python.org/mailman/listinfo/python-list
Re: Format String: Only when value supplied
On 6/24/14 5:18 AM, Florian Lindner wrote: Hello, I have a format string like: print "{:10} {:25} = {:6} ({})".format(mod, name, value, description) description can be None. In this case I want to print an empty string (which can be achieved by replacing it with 'description or ""') and I want to omit the brackets. Is there a way to tell the format string to omit a part if an input variable is None? .format() is not that sophisticated. One option is to build your string in pieces like this: if description: nice_description = " ({})".format(description) else: nice_description = "" print "{:10} {:25} = {:6}{}".format(mod, name, value, nice_description) Another option is to use a real templating engine like Mako or Jinja that lets you use conditionals. Another question: value can be bool. When I format value with just {} if prints True or False, when I use {:6} it prints 1 or 0. Is there a way to get pack to True / False? You can force it to be a string with "{!s:6}" -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the state of MySQL support for Python 3?
On Tuesday, June 24, 2014 12:48:14 PM UTC+3, Chris Angelico wrote: > > Is it completely from scratch? Can you just use PostgreSQL? It's *so* > > much better... The project is, but the database isn't. So MySQL it is. -- https://mail.python.org/mailman/listinfo/python-list
Re: Format String: Only when value supplied
On 2014-06-24 10:18, Florian Lindner wrote: Hello, I have a format string like: print "{:10} {:25} = {:6} ({})".format(mod, name, value, description) description can be None. In this case I want to print an empty string (which can be achieved by replacing it with 'description or ""') and I want to omit the brackets. Is there a way to tell the format string to omit a part if an input variable is None? You could strip the trailing brackets (and spaces too?) after formatting: print "{:10} {:25} = {:6} ({})".format(mod, name, value, description or "").rstrip("() ") assuming, of course, that the value never ends with brackets. Another question: value can be bool. When I format value with just {} if prints True or False, when I use {:6} it prints 1 or 0. Is there a way to get pack to True / False? -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-Topic: The Machine
On 24.06.2014 03:23, Steven D'Aprano wrote: > http://www.iflscience.com/technology/new-type-computer-capable- > calculating-640tbs-data-one-billionth-second-could > > Relevance: The Machine uses *eighty times less power* for the same amount > of computing power as conventional architectures. If they could shrink it > down to a mobile phone, your phone might last 2-3 months on a single > charge. The article is highly unscientific and unspecific. It does not elaborate on what it means to "calculate" a terabyte of data nor does it specify what it means to "handle" a petabyte of data. They're terms used by ignorants, written for ignorants. So all in all I think it's safe to discard the article. Also, mobile phones don't waste most of their power doing "calculating" and "handling" terabytes of data, but the RF and display consumes the most of power. Therefore, even if you could scale the CPU down your phone would still not go 2-3 months on a single charge. Cheers, Joe -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa -- https://mail.python.org/mailman/listinfo/python-list
Standard way to generate mail/news reply?
Is there some standard library or code for taking an e-mail or newsgroup message & generating a reply to it? (I mean things like quoting the original message, >> quoting etc. where necessary, & generating the right References & In-Reply-To headers.) I homebrewed some code for this in Perl (sorry) years ago, but before I reimplement it in Python, I thought I should ask if there's a "good" way. Thanks, Adam -- A recent study conducted by Harvard University found that the average American walks about 900 miles a year. Another study by the AMA found that Americans drink, on average, 22 gallons of alcohol a year. This means, on average, Americans get about 41 miles to the gallon. http://www.cartalk.com/content/average-americans-mpg -- https://mail.python.org/mailman/listinfo/python-list
Re: Standard way to generate mail/news reply?
On Tue, Jun 24, 2014 at 6:46 AM, Adam Funk wrote: > Is there some standard library or code for taking an e-mail or > newsgroup message & generating a reply to it? You might try searching for "mail reply" on pypi.python.org. That will return a number of hits. I know the python.org replybot is there and used frequently. It might be a good starting point. Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the state of MySQL support for Python 3?
Hi. PyMySQL -- pure Python MySQL connector. Supports Python 3.3~. mysqlclient -- Fork of MySQLdb. Supports Python 3.3~. On Tue, Jun 24, 2014 at 5:21 PM, wrote: > Good day, > > I'm starting a new project from scratch so I think its finally a time to > switch to the latest and greatest Python 3.4. > > But I'm puzzled with MySQL support for Python 3. So far the only stable > library I've found it pymysql. > > All others are either abandoned work-in-progress projects or do not support > Python 3: > * mysqldb - Python 2.x only > * mysql-ctypes - Python 2.x only > * amysql - Python 2.x only > * ultramysql - Python 2.x only > * MySQL Connector/Python - new guy in block. Does anyone use it? > * WebScaleSQL + MySQLdb1 [1] - still in development, state unknown? > * etc... > > So what library do you use for MySQL access in Python 3? > I'm specifically interested in async support (like in psycopg2 for > PostgreSQL) since I'm planning to use Tornado. > > Thanks, > Zaar > > [1] https://github.com/farcepest/MySQLdb1 > > https://code.facebook.com/posts/1474977139392436/webscalesql-a-collaboration-to-build-upon-the-mysql-upstream/ > > http://www.percona.com/live/mysql-conference-2014/sessions/asynchronous-mysql-how-facebook-queries-databases > > -- > https://mail.python.org/mailman/listinfo/python-list -- INADA Naoki -- https://mail.python.org/mailman/listinfo/python-list
Error in PyDev but not in the standard python interpreter
Hi, this is probably not the best place for this topic but I know this forum is widely read. I take this opportunity and apology at the same time. If I run this in my python3 interpreter everything works fine: mowglie@flappi ~ $ python3 Python 3.3.2+ (default, Feb 28 2014, 00:52:16) [GCC 4.8.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from netCDF4 import num2date >>> from datetime import datetime >>> d1 = num2date(0, 'days since 1000-01-01', 'standard') >>> d2 = datetime(2000, 1, 1) >>> print(d1 < d2) True But if I run the code in PyDev I get: print(d1 < d2) TypeError: unorderable types: datetime() < datetime.datetime() When debugging in pyDev, everything looks fine: >>> sys.version Out[28]: '3.3.2+ (default, Feb 28 2014, 00:52:16) \n[GCC 4.8.1]' >>> ?d1 Type: datetime String Form:1000-01-01 00:00:00 File: /usr/local/lib/python3.3/dist-packages/netcdftime.py Docstring: [...] >>> ?d2 Type: datetime String Form:2000-01-01 00:00:00 File: /usr/lib/python3.3/datetime.py Docstring: [...] >>> d1 < d2 Traceback (most recent call last): File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2732, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in d1 < d2 TypeError: unorderable types: datetime() < datetime.datetime() So they are two instances of the same object but something in pyDev doesn't want to compare them. Any Hint? Thanks! Fabien -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
On Tue, Jun 24, 2014 at 11:28 PM, Fabien wrote: > So they are two instances of the same object but something in pyDev doesn't > want to compare them. Any Hint? Are they really instances of the same class? One of them comes from /usr/local/lib/python3.3/dist-packages/netcdftime.py and the other comes from /usr/lib/python3.3/datetime.py - so they might be virtually identical (or they might not), but they're not the actual same class, and when __lt__ does its isinstance check, it doesn't pass. The real question is: Why is netCDF4 not using "import datetime" to get its datetime? And I think that's best answered with this, lifted from the netcdftime.utime docstring [1]: """ The datetime instances returned by C{num2date} are 'real' python datetime objects if the date falls in the Gregorian calendar (i.e. C{calendar='proleptic_gregorian', 'standard'} or C{'gregorian'} and the date is after 1582-10-15). Otherwise, they are 'phony' datetime objects which are actually instances of C{L{netcdftime.datetime}}. This is because the python datetime module cannot handle the weird dates in some calendars (such as C{'360_day'} and C{'all_leap'}) which don't exist in any real world calendar. """ (Similar info can be found in the docstring for netcdftime.datetime itself, but without the examples.) ISTM netcdftime.datetime should define __lt__() to permit comparisons with either others of itself or datetime.datetime objects, but in the absence of that, you're stuck with either ensuring that you're working with Gregorian dates, or writing your own comparison function. Good luck! ChrisA [1] https://code.google.com/p/netcdf4-python/source/browse/trunk/netcdftime.py?r=1117#522 -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
Hi Chris, thanks for the hint. Indeed they are not an instance of the same class: >>> isinstance(d1, datetime) Out[6]: False >>> isinstance(d2, datetime) Out[7]: True so this is something I should check with the NetCDF4 package developers. While The python interpreter can compare them, my pydev environment can't. Is pydev doing something "better" then python3 "alone"? Btw, the test case is extracted from the netCDF4package test suite, which passes on the linux command line but not on pydev because of this one code block... On 24.06.2014 15:47, Chris Angelico wrote: On Tue, Jun 24, 2014 at 11:28 PM, Fabien wrote: So they are two instances of the same object but something in pyDev doesn't want to compare them. Any Hint? Are they really instances of the same class? One of them comes from /usr/local/lib/python3.3/dist-packages/netcdftime.py and the other comes from /usr/lib/python3.3/datetime.py - so they might be virtually identical (or they might not), but they're not the actual same class, and when __lt__ does its isinstance check, it doesn't pass. The real question is: Why is netCDF4 not using "import datetime" to get its datetime? And I think that's best answered with this, lifted from the netcdftime.utime docstring [1]: """ The datetime instances returned by C{num2date} are 'real' python datetime objects if the date falls in the Gregorian calendar (i.e. C{calendar='proleptic_gregorian', 'standard'} or C{'gregorian'} and the date is after 1582-10-15). Otherwise, they are 'phony' datetime objects which are actually instances of C{L{netcdftime.datetime}}. This is because the python datetime module cannot handle the weird dates in some calendars (such as C{'360_day'} and C{'all_leap'}) which don't exist in any real world calendar. """ (Similar info can be found in the docstring for netcdftime.datetime itself, but without the examples.) ISTM netcdftime.datetime should define __lt__() to permit comparisons with either others of itself or datetime.datetime objects, but in the absence of that, you're stuck with either ensuring that you're working with Gregorian dates, or writing your own comparison function. Good luck! ChrisA [1] https://code.google.com/p/netcdf4-python/source/browse/trunk/netcdftime.py?r=1117#522 -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
On Tue, Jun 24, 2014 at 11:59 PM, Fabien wrote: > Hi Chris, > > thanks for the hint. Indeed they are not an instance of the same class: > isinstance(d1, datetime) > Out[6]: False isinstance(d2, datetime) > Out[7]: True > > so this is something I should check with the NetCDF4 package developers. > > While The python interpreter can compare them, my pydev environment can't. > Is pydev doing something "better" then python3 "alone"? > Here's what I'd try: >>> import sys >>> sys.modules[d1.__class__.__module__].__file__ >>> sys.modules[d2.__class__.__module__].__file__ Do those in both environments and see where things are actually coming from. (In PyDev, I expect that to tell you exactly the same file names as your question-mark inspection tells you, as that'll be how it obtains the information.) It might be that your module search path is different. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
Well, it 'appears' to be the same type, but given that the File from one is different from the other, I think they aren't... Googling a bit, I found the source: https://code.google.com/p/netcdf4-python/source/browse/trunk/netcdftime.py?r=1117 and it has a 'datetime' which says: "Phony datetime object which mimics the python datetime object", now, I'm not sure why it works in the Python shell but not in the IPython shell integrated in PyDev... You may want to create a module and do a debug run to step into the 'num2date' call to see what differs there... (i.e.: I think that if you do isinstance(d1, datetime) it'll return false, as it seems to be a netcdftime.datetime object). Best Regards, Fabio On Tue, Jun 24, 2014 at 10:28 AM, Fabien wrote: > Hi, > > this is probably not the best place for this topic but I know this forum > is widely read. I take this opportunity and apology at the same time. > > If I run this in my python3 interpreter everything works fine: > > mowglie@flappi ~ $ python3 > Python 3.3.2+ (default, Feb 28 2014, 00:52:16) > [GCC 4.8.1] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> from netCDF4 import num2date > >>> from datetime import datetime > >>> d1 = num2date(0, 'days since 1000-01-01', 'standard') > >>> d2 = datetime(2000, 1, 1) > >>> print(d1 < d2) > True > > But if I run the code in PyDev I get: > print(d1 < d2) > TypeError: unorderable types: datetime() < datetime.datetime() > > When debugging in pyDev, everything looks fine: > >>> sys.version > Out[28]: '3.3.2+ (default, Feb 28 2014, 00:52:16) \n[GCC 4.8.1]' > >>> ?d1 > Type: datetime > String Form:1000-01-01 00:00:00 > File: /usr/local/lib/python3.3/dist-packages/netcdftime.py > Docstring: > [...] > >>> ?d2 > Type: datetime > String Form:2000-01-01 00:00:00 > File: /usr/lib/python3.3/datetime.py > Docstring: > [...] > >>> d1 < d2 > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", > line 2732, in run_code > exec(code_obj, self.user_global_ns, self.user_ns) > File "", line 1, in > d1 < d2 > TypeError: unorderable types: datetime() < datetime.datetime() > > > So they are two instances of the same object but something in pyDev > doesn't want to compare them. Any Hint? > > Thanks! > > Fabien > > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
Hi Chris, On 24.06.2014 16:04, Chris Angelico wrote: Here's what I'd try: >>>import sys >>>sys.modules[d1.__class__.__module__].__file__ >>>sys.modules[d2.__class__.__module__].__file__ that was it! netCDF4 has two repositories online, one on google code and one on github. I mistakenly installed the old one, then I noticed the new one and obviously some old stuffs remained in the dist-packages directory. I removed them from my path and everything works fine in pydev now. Thanks a lot! Fab -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
On Wed, Jun 25, 2014 at 12:27 AM, Fabien wrote: > netCDF4 has two repositories online, one on google code and one on github. I > mistakenly installed the old one, then I noticed the new one and obviously > some old stuffs remained in the dist-packages directory. I removed them from > my path and everything works fine in pydev now. > > Thanks a lot! Awesome! In fact, looking at their github repo (or what seems to be it) shows that (currently) the most recent change to that file was exactly what I suggested ought to be done: add rich comparisons to the phony datetime. https://github.com/Unidata/netcdf4-python/blob/master/netcdftime.py Would be nice if there could be some clear indication that this is the official and current repo. When I went Googling for netCDF4, I found the other one first, with no indication that the github repo was better. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
On 24.06.2014 16:35, Chris Angelico wrote: Would be nice if there could be some clear indication that this is the official and current repo. indeed. Also, the install procedure is a bit dangerous for new python users like me. NetCDF4 is out since 2008, it would be great if SciPy could support it. Other related annoying stuff when learning is the good old 2.7 VS 3 problem: mowglie@flappi ~ $ apt-cache search SciPy [...] python-scipy - scientific tools for Python python3-scipy - scientific tools for Python 3 mowglie@flappi ~ $ apt-cache search python basemap [...] python-mpltoolkits.basemap - matplotlib toolkit to plot on map -> no native python3 package for basemap -> compilation required... But I'll stick to it. If so many people say it's great for scientific computing, python must be great right? ;-) -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
On Wed, Jun 25, 2014 at 1:40 AM, Fabien wrote: > Other related annoying stuff when learning is the good old 2.7 VS 3 problem: > > mowglie@flappi ~ $ apt-cache search SciPy > [...] > python-scipy - scientific tools for Python > python3-scipy - scientific tools for Python 3 > > mowglie@flappi ~ $ apt-cache search python basemap > [...] > python-mpltoolkits.basemap - matplotlib toolkit to plot on map > > -> no native python3 package for basemap -> compilation required... Wouldn't have the foggiest as regards basemap, it might be that it actually doesn't support Py3. (Also, it may depend on your exact distro and version. I confirmed what you see there on Debian Wheezy, but you might get different results on Debian Sid, or Scibuntu, etc, etc.) You may want to consider using pip if apt doesn't have what you want; it might be possible to get basemap that way. > But I'll stick to it. If so many people say it's great for scientific > computing, python must be great right? ;-) Again, I couldn't say (I'm not into the heavy scientific work myself)... but I can confirm that Python is an excellent language. Along with Pike (a very similar language but with focus more on long-running servers), Python holds pride of place in my coding work. Basically, C is for writing high level languages in, and Python and Pike are for writing applications. Life is good. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
On 06/24/2014 08:58 AM, Chris Angelico wrote: Basically, C is for writing high level languages in, and Python and Pike are for writing applications. Life is good. +1 QOTW -- https://mail.python.org/mailman/listinfo/python-list
Re: Error in PyDev but not in the standard python interpreter
On 06/24/2014 07:04 AM, Chris Angelico wrote: Here's what I'd try: import sys sys.modules[d1.__class__.__module__].__file__ sys.modules[d2.__class__.__module__].__file__ Do those in both environments and see where things are actually coming from. Debugging tips always appreciated. Thanks, Chris! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Python 3.4.1 installer on Mac links Python to old Tcl/Tk
Hello, I use the Python 3.4.1 installer from https://www.python.org/downloads/release/python-341/ The Windows installation comes with Tcl/Tk version 8.6 which has some new features (compared to 8.5) that are very important to me. But the Mac installer does not include Tcl/Tk and the page: https://www.python.org/download/mac/tcltk says: "The Python 64-bit/32-bit Mac OS X installers for Python 3.4.x, 3.3.x, 3.2.x, and 2.7.x dynamically link to Tcl/Tk 8.5 frameworks." I tried to download and install ActiveTcl 8.6.1 for Mac, but Python does not use it... Can anyone help me make Python 3.4.1 use Tcl/Tk 8.6 on Mac OS X (10.9.2, if that matters)? Does anyone know why the Windows installer brings the newest version of Tcl/Tk while the Mac installer remains with the previous version? When this is planned to be changed? Maybe this is not the right place for this kind of question... can anyone suggest a better place so that the question has a chance to be read by the person who is actually creating the installation packages? Should I try to send this as a bug to bugs.python.org? Thanks, Peter Tomcsanyi -- https://mail.python.org/mailman/listinfo/python-list
Passing a frame to pdb.Pdb.set_trace
Hi all, I've found something weird with pdb and I don't understand it. I want to define a function mydebugger() which starts the debugger in the caller's frame. The following is copied from IDLE with Python 2.7.3 (I've since tried it with 3.3.0 and the same thing happens): Python 2.7.3 (default, Feb 27 2014, 19:58:35) [GCC 4.6.3] on linux2 Type "copyright", "credits" or "license()" for more information. >>> import pdb, sys >>> def f(x): mydebugger() >>> def mydebugger(): frame = sys._getframe().f_back pdb.Pdb().set_trace(frame) >>> f(4) --Return-- > (2)f()->None (Pdb) x 4 This is what I expect: sys._getframe().f_back gives f's frame, so the call to mydebugger() within f does approximately the same thing as if I'd just called pdb.set_trace() instead. But when I add another statement to mydebugger, this happens: >>> def mydebugger(): frame = sys._getframe().f_back pdb.Pdb().set_trace(frame) print 'hmm' >>> f(4) --Call-- > /usr/lib/python2.7/idlelib/rpc.py(546)__getattr__() -> def __getattr__(self, name): (Pdb) x *** NameError: name 'x' is not defined (Pdb) w #Where am I? (1)() /usr/lib/python2.7/idlelib/run.py(97)main() -> ret = method(*args, **kwargs) /usr/lib/python2.7/idlelib/run.py(298)runcode() -> exec code in self.locals (1)() (2)f() (4)mydebugger() > /usr/lib/python2.7/idlelib/rpc.py(546)__getattr__() -> def __getattr__(self, name): The same thing happens if I define frame = sys._getframe().f_back.f_back (i.e. the debugger starts in the same place) for example, though if I define frame = sys._getframe() then the debugger starts in mydebugger's frame as I would expect. Also, whether it goes wrong depends on what the third line of mydebugger is; some kinds of statement consistently cause the problem and others consistently don't. When I try the above simple code in the terminal rather than IDLE it works like it should, but in the more complicated version where I first noticed it it still goes wrong. Can anyone help? -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.4.1 installer on Mac links Python to old Tcl/Tk
In article , "Peter Tomcsanyi" wrote: > I use the Python 3.4.1 installer from > https://www.python.org/downloads/release/python-341/ > > The Windows installation comes with Tcl/Tk version 8.6 which has some new > features (compared to 8.5) that are very important to me. > > But the Mac installer does not include Tcl/Tk and the page: > https://www.python.org/download/mac/tcltk > says: > "The Python 64-bit/32-bit Mac OS X installers for Python 3.4.x, 3.3.x, > 3.2.x, and 2.7.x dynamically link to Tcl/Tk 8.5 frameworks." > > I tried to download and install ActiveTcl 8.6.1 for Mac, but Python does not > use it... > > Can anyone help me make Python 3.4.1 use Tcl/Tk 8.6 on Mac OS X (10.9.2, if > that matters)? > > Does anyone know why the Windows installer brings the newest version of > Tcl/Tk while the Mac installer remains with the previous version? When this > is planned to be changed? The main reason is that we have tried to follow what Apple does with OS X. Unlike Windows, OS X is shipped with Apple-supplied versions of Tcl/Tk. For OS X 10.6, Apple helped support the development of a new native variant of Tk for OS X (the Cocoa Tk) that supports 64-bit mode. The previous OS X native mode Tk (Carbon) only works in 32-bit processes. At the time of the release of 10.6, Tk 8.6 was not yet released. For whatever reasons, Apple has continued to ship only 8.5 and 8.4 in releases through current 10.9.x. Unfortunately, it has turned out that Cocoa Tk has had a number of very serious bugs. Many of them have been fixed in newer releases of 8.5.x and the now-released 8.6.x but remain unfixed in the older versions of 8.5.x shipped by Apple. Also, up until relatively recent releases, there were issues with Python's Tkinter when built and linked with Tk 8.6.x. We think most of those issues should have been fixed in the current releases (like 3.4.1). But, because of the messy situation with Tk support on OS X, there really hasn't been an incentive for us to move to 8.6.x for the python.org OS X installers; it's been challenging enough to get 8.5.x stable. Another issue is that there are binary installers for some popular third-party packages for Python on OS X that depend on the python.org installers and also depend on Tk (like matplotlib) so any change in Tk version would affect them as well. At some point, I would like to move to 8.6.x or at least make it an option but we don't have a schedule for it yet. It's a bit messy to try to build Python with Tk 8.6 yourself from source but it can be done if you don't mind not using the python.org version. To do so, make sure you have ActiveTcl 8.6 installed and that it is the "Current" version in the /Library/Frameworks for Tcl and Tk. Then configure Python for a framework build (--enable-framework). Probably easier, though, is to install Python 3.4 from MacPorts which does provide its own version of Tcl/Tk 8.6.1, the Cocoa version by default or optionally an X11 version: # after installing the base MacPorts sudo port selfupdate sudo port install py34-tkinter +quartz /opt/local/bin/python3.4 The easiest option would be a downloadable package that would allow the default python.org 8.5-linked _tkinter to be overridden with an 8.6 version. There may be some news on that front in the near future. -- Ned Deily, n...@acm.org -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.4.1 installer on Mac links Python to old Tcl/Tk
In article , > Maybe this is not the right place for this kind of question... can anyone > suggest a better place so that the question has a chance to be read by the > person who is actually creating the installation packages? Should I try to > send this as a bug to bugs.python.org? P.S. Yes, in general, issues with the python.org binary installers for Windows and OS X can be addressed through bugs.python.org. -- Ned Deily, n...@acm.org -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.4.1 installer on Mac links Python to old Tcl/Tk
"Ned Deily" wrote in message news:nad-d2ddcb.14070824062...@news.gmane.org... Probably easier, though, is to install Python 3.4 from MacPorts which does provide its own version of Tcl/Tk 8.6.1, the Cocoa version by default or optionally an X11 version: # after installing the base MacPorts sudo port selfupdate sudo port install py34-tkinter +quartz /opt/local/bin/python3.4 The easiest option would be a downloadable package that would allow the default python.org 8.5-linked _tkinter to be overridden with an 8.6 version. There may be some news on that front in the near future. Many thanks for the quick reply. I will try the MacPorts version, but I am quite Windows-based (I do the Mac installation for somebody else), so I am not sure how to install all the other packages that we use (NumPy, MatPlotLib, Pillow and maybe something else that I do not recall at this moment...). Last time (for the python.org version of Python) I needed to try out several approached from several sites to succeed finally... So I will impatiently expect the changes "on that front" and I will hope that they will come till August 2014. Peter Tomcsanyi -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-Topic: The Machine
On Tue, 24 Jun 2014 13:06:56 +0200, Johannes Bauer wrote: > On 24.06.2014 03:23, Steven D'Aprano wrote: >> http://www.iflscience.com/technology/new-type-computer-capable- >> calculating-640tbs-data-one-billionth-second-could >> >> Relevance: The Machine uses *eighty times less power* for the same >> amount of computing power as conventional architectures. If they could >> shrink it down to a mobile phone, your phone might last 2-3 months on a >> single charge. > > The article is highly unscientific and unspecific. It does not elaborate > on what it means to "calculate" a terabyte of data nor does it specify > what it means to "handle" a petabyte of data. They're terms used by > ignorants, written for ignorants. Heh, yes, it's a puff-piece, based on HP's publicity, not an in-depth review. Considering that The Machine isn't publicly available yet, that's hardly surprising. > So all in all I think it's safe to discard the article. Taking it with a generous grain of salt is one thing, but outright rejecting it is a bit harsh. I understand that HP has actually demonstrated the Machine, so unless they faked the demo, the basic facts are probably more-or-less correct. > Also, mobile phones don't waste most of their power doing "calculating" > and "handling" terabytes of data, but the RF and display consumes the > most of power. Therefore, even if you could scale the CPU down your > phone would still not go 2-3 months on a single charge. Fair point. But given how much smart phones get used for playing games these days, I think the savings would still be considerable. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-Topic: The Machine
On Wed, Jun 25, 2014 at 3:52 PM, Steven D'Aprano wrote: > Taking it with a generous grain of salt is one thing, but outright > rejecting it is a bit harsh. I understand that HP has actually > demonstrated the Machine, so unless they faked the demo, the basic facts > are probably more-or-less correct. Like all benchmarks used in advertising, it's going to focus on what the machine does well, regardless of how closely that parallels real-world usage. Legit ones attempt to ensure that there's at least some correlation, but even then, it's impossible to be totally fair. So "more-or-less correct" may be true, but I still take *all* such benchmarks with the aforementioned salt. >> Also, mobile phones don't waste most of their power doing "calculating" >> and "handling" terabytes of data, but the RF and display consumes the >> most of power. Therefore, even if you could scale the CPU down your >> phone would still not go 2-3 months on a single charge. > > Fair point. > > But given how much smart phones get used for playing games these days, I > think the savings would still be considerable. Plus, most of computing is just doing the same thing over and over again. The improvements done to the CPU might well be able to be applied, in a different form, to other parts of the device. Sure, the screen has to emit light, which costs power; but if computation is cheap enough, it might be possible to calculate exactly how much light is falling on the screen, and back down the brightness automatically when you move into shadow. Engineering is generally about trading one resource for another, so gains in one area can result in gains in others too. Of course, it's always possible for beautiful engineering to be destroyed by stupid politicking. But here's hoping. ChrisA -- https://mail.python.org/mailman/listinfo/python-list