Pillow installation failed for python with my custom opcode
Hi guys, I don't know if here is right place for asking this question, if not, please help me route to the right place. I do some simple tests on custom opcode for python. 1. change opcode.h: for example: #define PRINT_EXPR 70 #define PRINT_ITEM 71 #define PRINT_NEWLINE 72 #define PRINT_ITEM_TO 73 #define PRINT_NEWLINE_TO 74 to this new values: #define PRINT_EXPR 74 #define PRINT_ITEM 70 #define PRINT_NEWLINE 71 #define PRINT_ITEM_TO 72 #define PRINT_NEWLINE_TO 73 2. then, configure/make/make install I see the customized python is executable. And, I use pip to install other packages like django,south, mysql-python successfully. But, when I execute 'pip install pillow' to install pillow version 2.7, error happend and snippet here: Building using 4 processes gcc -pthread -shared build/temp.linux-x86_64-2.7-pydebug/_imaging.o build/temp.linux-x86_64-2.7-pydebug/decode.o build/temp.linux-x86_64-2.7-pydebug/encode.o build/temp.linux-x86_64-2.7-pydebug/map.o build/temp.linux-x86_64-2.7-pydebug/display.o build/temp.linux-x86_64-2.7-pydebug/outline.o build/temp.linux-x86_64-2.7-pydebug/path.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Access.o build/temp.linux-x86_64-2.7-pydebug/libImaging/AlphaComposite.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Resample.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Bands.o build/temp.linux-x86_64-2.7-pydebug/libImaging/BitDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Blend.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Chops.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Convert.o build/temp.linux-x86_64-2.7-pydebug/libImaging/ConvertYCbCr.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Copy.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Crc32.o build/temp.linux-x86_64-2.7-pydeb ug/libImaging/Crop.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Dib.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Draw.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Effects.o build/temp.linux-x86_64-2.7-pydebug/libImaging/EpsEncode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/File.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Fill.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Filter.o build/temp.linux-x86_64-2.7-pydebug/libImaging/FliDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Geometry.o build/temp.linux-x86_64-2.7-pydebug/libImaging/GetBBox.o build/temp.linux-x86_64-2.7-pydebug/libImaging/GifDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/GifEncode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/HexDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Histo.o build/temp.linux-x86_64-2.7-pydebug/libImaging/JpegDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/JpegEncode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/LzwDecode.o buil d/temp.linux-x86_64-2.7-pydebug/libImaging/Matrix.o build/temp.linux-x86_64-2.7-pydebug/libImaging/ModeFilter.o build/temp.linux-x86_64-2.7-pydebug/libImaging/MspDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Negative.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Offset.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Pack.o build/temp.linux-x86_64-2.7-pydebug/libImaging/PackDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Palette.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Paste.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Quant.o build/temp.linux-x86_64-2.7-pydebug/libImaging/QuantOctree.o build/temp.linux-x86_64-2.7-pydebug/libImaging/QuantHash.o build/temp.linux-x86_64-2.7-pydebug/libImaging/QuantHeap.o build/temp.linux-x86_64-2.7-pydebug/libImaging/PcdDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/PcxDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/PcxEncode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Point.o build/temp.linux-x86 _64-2.7-pydebug/libImaging/RankFilter.o build/temp.linux-x86_64-2.7-pydebug/libImaging/RawDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/RawEncode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Storage.o build/temp.linux-x86_64-2.7-pydebug/libImaging/SunRleDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/TgaRleDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Unpack.o build/temp.linux-x86_64-2.7-pydebug/libImaging/UnpackYCC.o build/temp.linux-x86_64-2.7-pydebug/libImaging/UnsharpMask.o build/temp.linux-x86_64-2.7-pydebug/libImaging/XbmDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/XbmEncode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/ZipDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/ZipEncode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/TiffDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Incremental.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Jpeg2KDecode.o build/temp.linux-x86_64-2.7-pydebug/libImaging/Jpeg2KEncode.o b uild/temp.linux-x86_64-2.7-pydebug/libImaging/BoxBlur.o -L/home/src/mypy27/lib -L/lib64 -L/usr/lib64 -L/usr/local/lib -L/usr/l
Re: __new__() does not return anything, on singletong pattern
On Thu, 12 Mar 2015 16:31:12 +1100, Steven D'Aprano wrote: >Mario Figueiredo wrote: > > >If this is supposed to be a singleton, you can't create more instances. The >point of a singleton that there is only one instance (or perhaps a small >number, two or three say). Why do you need two different ways to create >instances if you only have one instance? > The map is instantiated from the contents of a saved map file on the main application. A different application, a map editor, needs to also instantiate an object of the class Map. But in this case the map needs to either be empty (if the user wants to create a new map), or loaded from the saved map file (if the user wants to edit an existing map). > >> I added the following method to the class definition, above: >> >> @classmethod >> def generate(cls, width, height, fill=terrain[6]): >> if Map._instance is None: >> Map._instance = super(Map, cls).__new__(cls) >> else: >> raise Exception('Cannot generate an instance of Map.') >> >> Map._instance.author = None >> Map._instance.name = None > >Since this method modifies the singleton instance in place, it doesn't >generate a new instance. It shouldn't be called generate(). No sure what you mean. That method either creates a new instance or raises an exception. It doesn't modify an instance in-place. > >> Map._instance.description = None >> # etc... >> self.cells = [Cell(fill)] * width * height >> return Map._instance > >That's not your actual code, since the indentation is wrong. Map._instance.description = None # etc... self.cells = [Cell(fill)] * width * height return Map._instance -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
On Wed, 11 Mar 2015 16:47:32 -0700, Ethan Furman wrote: > >You're code is good. Thanks for taking a weight off my shoulder. > > The only question is if you /really/ need a singleton -- and only > you can answer that (although plenty of folks will tell you you > don't ;) . Yeah. I debated that myself. But in the end the singleton won. It's just a cheap global, since is ubiquitous throughout the entire application, does behave like a singleton, and is a bit too expensive to create. A full map in the main application takes 3 or 4 seconds to instantiate and occupies around 2 Mb of memory. -- https://mail.python.org/mailman/listinfo/python-list
I want to get involved with Python!
Hi, I am currently a "Progress Programmer" and looking for new challenges! It seems that Python is a good language to get familiar with and I would like some advice. I am on the look-out for a new job anyway and I thought it well to look for a job as Python developer in my field. I have been working in the healthcare sector for many years now and perhaps the only way to find a job as Python programmer at this stage, will be to find a job in the healthcare sector, as this is what I am familiar with. Are there any healthcare companies using Python (anywhere in the world) that I can contact for opportunities and advice? I currently live in South Africa and would like to know what the demand for Python is in SA, but I will also consider relocating to Australia or the UK if I find it's going to be worth it. Please advise on what route you would suggest I take to become a Python developer! Thanks, Bianca. -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
Mario Figueiredo wrote: It's just a cheap global, since is ubiquitous throughout the entire application, does behave like a singleton, and is a bit too expensive to create. A full map in the main application takes 3 or 4 seconds to instantiate and occupies around 2 Mb of memory. There's nothing wrong with having only one instance. The quesion is whether it's a good idea to make calling Map() be the way to get hold of that instance. I would say it's counterproductive. The implementation is convoluted, and it makes code that calls Map() confusing, because it looks like it's creating a new instance when it really isn't. I would just provide a function: _map = None def get_map(): global _map if _map is None: _map = Map() return _map and document the fact that you shouldn't call Map() directly. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
Mario Figueiredo wrote: A different application, a map editor, needs to also instantiate an object of the class Map. But in this case the map needs to either be empty (if the user wants to create a new map), or loaded from the saved map file (if the user wants to edit an existing map). Then you have two functions for creating maps: new_empty_map() load_map_from_file(filename) Both of these can complain if there is already a Map instance. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
python-wheel distribution, add a local dependency which is not available in PyPi
Hi I have a dependency of a local .whl file, which is not in Pypi. How can I bundle that (local .whl file) inside the wheel file, so that inner .whl will get installed as a dependency. In simple terms a wheel file inside another wheel file. Can I add it as a package_data ? , if so how can get it automatically installed as a dependency? Please help -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
Mario Figueiredo wrote: But PyCharm flags the assignment with a warning telling me that generate() does not return anything and the I lose code completion on the mmap variable. My guess is that there is a syntax error somewhere in your code that's confusing the IDE. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
On Thu, 12 Mar 2015 21:38:00 +1300, Gregory Ewing wrote: > >I would just provide a function: > >_map = None > >def get_map(): >global _map >if _map is None: > _map = Map() >return _map > >and document the fact that you shouldn't call Map() >directly. Oh, you are so right! Been so long since I last created a singleton I forgot all about the idiomatic approaches to the pattern. Thanks Greg. That is much, much, better. -- https://mail.python.org/mailman/listinfo/python-list
RE: Re: I want to get involved with Python!
>https://en.wikipedia.org/wiki/OpenEdge_Advanced_Business_Language Yip, that's the one I am referring to, Terry. From: tjre...@udel.edu Sent: 2015/03/11 08:43:42 PM To: python-list@python.org Cc: Subject: RE: Re: I want to get involved with Python! On 3/11/2015 5:19 AM, bink...@mweb.co.za wrote: > I am currently a "Progress Programmer" and looking for new challenges! Are you referring to https://en.wikipedia.org/wiki/OpenEdge_Advanced_Business_Language > It seems that Python is a good language to get familiar with and I would > like some advice. I am on the look-out for a new job anyway and I > thought it well to look for a job as Python developer in my field. I > have been working in the healthcare sector for many years now and > perhaps the only way to find a job as Python programmer at this stage, > will be to find a job in the healthcare sector, as this is what I am > familiar with. Are there any healthcare companies using Python (anywhere > in the world) that I can contact for opportunities and advice? > > I currently live in South Africa and would like to know what the demand > for Python is in SA, but I will also consider relocating to Australia or > the UK if I find it's going to be worth it. > > Please advise on what route you would suggest I take to become a Python > developer! One way to establish credibility as a 'python programmer' is to make contributions to an open-source python project. Perhaps find or create a project to somehow integrate Python and Progress. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
EuroPython 2015: Early-Bird tickets sold out!
We are very happy to announce that early-bird tickets are sold out! The tickets were sold in less than a week! We’d like to thank everyone for the fantastic feedback. Given the rush to the early-bird tickets (we sold 100 tickets in the first 4 hours), we recommend to not wait too long before getting your standard ticket. It is likely, we’ll sell out early again this year. As announced we had temporarily closed the registration for a short while today and have now reopened it with the standard rate prices: *** https://ep2015.europython.eu/en/registration/ *** Enjoy, -- EuroPython 2015 Team http://www.europython-society.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
On Thu, 12 Mar 2015 21:40:03 +1300, Gregory Ewing wrote: >Mario Figueiredo wrote: > >> A different application, a map editor, needs to also instantiate an >> object of the class Map. But in this case the map needs to either be >> empty (if the user wants to create a new map), or loaded from the >> saved map file (if the user wants to edit an existing map). > >Then you have two functions for creating maps: > >new_empty_map() > >load_map_from_file(filename) > >Both of these can complain if there is already a >Map instance. new_empty_map(width, height, fill=terrain['sea']) load_map_from_file(filename) These would be the most likely signatures for those functions. The first function does not need to perform any of code to do with opening and reading a binary file, verifying an hash for possible file data corruption, filling the map header information and populating the cells. Both functions need to have knowledge of the Map class internals. Is it pythonic to create those functions in the same module of the Map class. Or because of how they have access to some "private" details of the class they should instead be made static methods as a means to signal that much? Map.new() Map.load() -- https://mail.python.org/mailman/listinfo/python-list
Re: when may sys.executable be empty
On 3/11/2015 10:41 AM, Wolfgang Maier wrote: From the documentation of sys.executable: A string giving the absolute path of the executable binary for the Python interpreter, on systems where this makes sense. If Python is unable to retrieve the real path to its executable, sys.executable will be an empty string or None. So on which systems does it not make sense ? Importing tkinter in a Python program starts up an embedded tcl interpreter to run tk, but as far as I know, there is no tcl.exe on my system, only the tcl/tk .dlls. I can imagine a similar situation with embedded python. If a python interpreter is being run as an embedded interpreter *and* there is the same version of python.exe installed, I don't know what happens. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Use à Python 2 module with Python 3
On Wed, Mar 11, 2015 at 11:30 AM, Michael Parchet wrote: > Hello, > > Only one file of pyside project has update at 10 fob, > > What's your opinion > > Pyside is ded ? This thread has some discussion that would be useful in determining the current state of the project: https://groups.google.com/forum/#!topic/pyside-dev/weFDtFpgbzc Summarizing, it seems that Digia is not interested in PySide development, but there are a number of individuals who are. I'm not sure what the actual progress is of the work described there. PySide isn't dead. It's resting. Would it be advisable to use it at the current time for a new project that you intend to support into the future? Probably not. -- https://mail.python.org/mailman/listinfo/python-list
Re: Use à Python 2 module with Python 3
On 03/11/2015 11:30 AM, Michael Parchet wrote: > Hello, > > Only one file of pyside project has update at 10 fob, > > What's your opinion > > Pyside is ded ? Qt 4 is very stable, with no new features. PySide works very well for me, and the few bugs/limitations that I know of can be worked around quite easily, and it's trivial to maintain direct compatibility with PyQt, so PyQt can always be a good fallback (remember PyQt is a commercial product, so you must buy a license if you want to use it under anything other than the GPL). My biggest complaint with PySide is that for historical reasons (looking at you, PyQt), it does not use pep8 naming conventions, which makes for some really ugly function and method names. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python3: Reading a text/binary mixed file
On 11-03-2015 01:09, Cameron Simpson wrote: > On 10Mar2015 22:38, Paulo da Silva wrote: >> On 10-03-2015 04:14, Cameron Simpson wrote: ... > > Since binary files (returning bytes from reads) also have a convenient > readline method looking for byte 10 ('\n') this makes you current task > tractable ... That was the big part of my problem. I wrongly assumed that readline was not available in binary mode. I should have tried it in first place :-) Thanks -- https://mail.python.org/mailman/listinfo/python-list
Callbacks with concurrent.futures
I have a ProcessPoolExecutor for which I am attaching multiple callbacks. As this must be process based and not thread based, I don't have the luxury communication between threads. Without a queue, does something inherent exist in concurrent futures that allows me to accumulate some data from the final callback? Thanks, jlc -- https://mail.python.org/mailman/listinfo/python-list
Re: Callbacks with concurrent.futures
On Wed, Mar 11, 2015 at 1:32 PM, Joseph L. Casale wrote: > I have a ProcessPoolExecutor for which I am attaching multiple callbacks. > As this must be process based and not thread based, I don't have the > luxury communication between threads. Without a queue, does something > inherent exist in concurrent futures that allows me to accumulate some > data from the final callback? ProcessPoolExecutor is built on the multiprocessing module, so I expect you should be able to use multiprocessing.Queue or multiprocessing.Pipe in place of threading.Queue. -- https://mail.python.org/mailman/listinfo/python-list
Re: Callbacks with concurrent.futures
> ProcessPoolExecutor is built on the multiprocessing module, so I > expect you should be able to use multiprocessing.Queue or > multiprocessing.Pipe in place of threading.Queue. Hi Ian, Yeah I am using a Manager.Queue as the method polling the queue is itself in a process. I just wondered if there was some facility in the module that provided communication or if I had to handle. Thanks! jlc -- https://mail.python.org/mailman/listinfo/python-list
ANN: eGenix mxODBC 3.3.2 - Python ODBC Database Interface
ANNOUNCING eGenix.com mxODBC Python ODBC Database Interface Version 3.3.2 mxODBC is our commercially supported Python extension providing ODBC database connectivity to Python applications on Windows, Mac OS X, Unix and BSD platforms with many advanced Python DB-API extensions and full support of stored procedures This announcement is also available on our web-site for online reading: http://www.egenix.com/company/news/eGenix-mxODBC-3.3.2-GA.html INTRODUCTION mxODBC provides an easy-to-use, high-performance, reliable and robust Python interface to ODBC compatible databases such as MS SQL Server, Oracle Database, IBM DB2, Informix and Netezza, SAP Sybase ASE and Sybase Anywhere, Teradata, MySQL, MariaDB, PostgreSQL, SAP MaxDB and many more: http://www.egenix.com/products/python/mxODBC/ The "eGenix mxODBC - Python ODBC Database Interface" product is a commercial extension to our open-source eGenix mx Base Distribution: http://www.egenix.com/products/python/mxBase/ NEWS The 3.3.2 release of our mxODBC is a patch level release of our popular Python ODBC Interface for Windows, Linux, Mac OS X and FreeBSD. It includes these enhancements and fixes: Driver Compatibility MS SQL Server * Fixed an "ODBC driver sent negative string size" error when using empty strings or None with output parameters for SQL Server ODBC drivers. * Clarified that due to the way the SQL Server ODBC driver sends data, mixing output parameters and output result sets is not possible. A work-around for this is to send back output parameters as additional result set. SAP Sybase ASE * Added a work-around for the Sybase ASE ODBC driver which has problems with BIGINT columns. These are now supported. * Fixed a possible "ODBC driver sent negative string size" error when using empty strings or None with output parameters for Sybase ASE ODBC drivers. Misc * Fixed the handling of None as default value for output parameters in e.g. stored procedures to use VARCHAR binding rather than CHAR binding. The latter caused padding with some database backends. * Changed cursor.colcount to be determined on-demand rather than right after the prepare step of statement execution. * Fixed an issue with mxODBC triggering unwanted ODBC errors after the prepare step when calling a stored procedure. These were not reported, but do show up in the ODBC log. * Fixed some minor issues with the package web installer. For the full set of changes please check the mxODBC change log: http://www.egenix.com/products/python/mxODBC/changelog.html FEATURES mxODBC 3.3 was released on 2014-04-08. Please see the full announcement for highlights of the 3.3 release: http://www.egenix.com/company/news/eGenix-mxODBC-3.3.0-GA.html For the full set of features mxODBC has to offer, please see: http://www.egenix.com/products/python/mxODBC/#Features EDITIONS mxODBC is available in these two editions: * The Professional Edition, which gives full access to all mxODBC features. * The Product Development Edition, which allows including mxODBC in applications you develop. For a complete overview of the available editions, please see the product page: http://www.egenix.com/products/python/mxODBC/#mxODBCEditions DOWNLOADS The download archives and instructions for installing the package can be found at: http://www.egenix.com/products/python/mxODBC/ In order to use the eGenix mxODBC package you will first need to install the eGenix mx Base package: http://www.egenix.com/products/python/mxBase/ You can also simply use: pip install egenix-mxodbc and then get evaluation licenses from our website to try mxODBC: http://www.egenix.com/products/python/mxODBC/#Evaluation UPGRADING Users are encouraged to upgrade to this latest mxODBC release to benefit from the new features and updated ODBC driver support. We have taken special care not to introduce backwards incompatible changes, making the upgrade experience as smooth as possible. Customers who have purchased mxODBC 3.3 licenses can continue to use their licenses with this patch level release. For upgrade purchases, we will give out 20% discount coupons going from mxODBC 2.x to 3.3 and 50% coupons for upgrades from mxODBC 3.x to 3.3. Please contact the eGenix.
Re: __new__() does not return anything, on singletong pattern
Mario Figueiredo wrote: > It's just a cheap global, since is ubiquitous throughout the entire > application, does behave like a singleton, and is a bit too expensive > to create. A full map in the main application takes 3 or 4 seconds to > instantiate and occupies around 2 Mb of memory. 2MB is not that big. 3-4 seconds to instantiate is a bit worrying, but you should look at improving the efficiency of loading a map rather than insisting that there should be only one map instance. Particularly in the map editor, what if the user wants to copy parts of one map into a second map? I've often wanted to do that with games. Every other editor, from music editors to text editors, allows you to have multiple documents open. Why should game level editors be stuck in the 1980s? While Map is a singleton, editing multiple maps at once is impossible (or at least tiresomely difficult). -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
Mario Figueiredo wrote: > On Thu, 12 Mar 2015 16:31:12 +1100, Steven D'Aprano > wrote: > >>Mario Figueiredo wrote: >> >> >>If this is supposed to be a singleton, you can't create more instances. >>The point of a singleton that there is only one instance (or perhaps a >>small number, two or three say). Why do you need two different ways to >>create instances if you only have one instance? >> > > The map is instantiated from the contents of a saved map file on the > main application. > > A different application, a map editor, needs to also instantiate an > object of the class Map. But in this case the map needs to either be > empty (if the user wants to create a new map), or loaded from the > saved map file (if the user wants to edit an existing map). An empty map is just a special case of an existing map, one with no features added. I would have a loadfile() method which takes a filename on disk, opens the file and passes the contents (or the open file object) to another method, load() to do the actual work: class Map: def __new__(cls, width, height, fill, treasure=None): # Include additional args as needed. map = super().__new__.(cls) map.width = width map.height = height map.fill = fill map.treasure = treasure return map @classmethod def loadfile(cls, filename): with open(filename, 'r') as f: map = cls.load(f) return map @classmethod def load(cls, f): # validate and parse file contents # extract width, height, fill, etc. map = cls(width, height, fill, treasure) return map To get an empty map, you pass the load method a file-like object that contains whatever an empty map data file will contain. That could literally be an external file, if you so choose, or you could simply read it from a global constant or even an embedded string/bytes object: @classmethod def new(cls): """Return a new empty map.""" emptymap = b"blah blah blah width=100 height=100 fill=1" f = io.StringIO(emptymap) return cls.load(f) This, naturally, assumes that your map format is simple enough and small enough that an empty map can be embedded into your code. If an empty map is 4MB on disk, you probably don't want to do this :-) Alternatively, set the default arguments to the __new__ constructor to be whatever values an empty map uses: def __new__(cls, width=100, height=100, fill=1, treasure=None): ... and now your "create empty map" command just calls Map() with no arguments. >>> I added the following method to the class definition, above: >>> >>> @classmethod >>> def generate(cls, width, height, fill=terrain[6]): >>> if Map._instance is None: >>> Map._instance = super(Map, cls).__new__(cls) >>> else: >>> raise Exception('Cannot generate an instance of Map.') >>> >>> Map._instance.author = None >>> Map._instance.name = None >> >>Since this method modifies the singleton instance in place, it doesn't >>generate a new instance. It shouldn't be called generate(). > > No sure what you mean. That method either creates a new instance or > raises an exception. It doesn't modify an instance in-place. My mistake, I was confused. You're right, if the instance already exists, it raises an exception. >>> Map._instance.description = None >>> # etc... >>> self.cells = [Cell(fill)] * width * height >>> return Map._instance >> >>That's not your actual code, since the indentation is wrong. > > Map._instance.description = None > # etc... > self.cells = [Cell(fill)] * width * height > return Map._instance What's "self"? That's a classmethod, it's not usual to have a self local variable. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
EuroPython 2015: Call for proposal dates available
The Program work group (WG) has decided on the dates for the Call for Proposal (CFP) dates: Monday, 2015-03-16 Tuesday, 2015-04-14 You will be able to submit your proposals through the EuroPython website during these 4 weeks. We have these types of presentations available for submission: * Talks: 170 slots available (80x 30min, 85x 45min, 5x 60min) * Trainings: 20 slots * Posters: 25 slots * Help desks: 5 slots Please note that the exact number of submissions we can accept depends on schedule and room requirements, so the above numbers are only estimates. Talk times include time for questions. The full Call for Proposal with all details will be made available on Monday, 2015-03-16. We are publishing these dates early because we’ve been getting a lot of requests for the CFP dates. Talks/Trainings in Spanish and Basque - Since EuroPython is hosted in Bilbao and EuroPython has traditionally always been very open to the local Python communities, we are also accepting a number of talks and trainings in Spanish and Basque. All other talks/trainings should be held in English. Talk voting --- As in 2013, we will again have talk voting, which means that attendees who have already registered will get to see the talk submissions and can vote on them. The Program WG will also set aside a number of slots which they will then select based on other criteria to e.g. increase diversity or give a chance to less mainstream topics. The schedule will then be announced early in May. Enjoy, -- EuroPython 2015 Team http://www.europython-society.org/ -- https://mail.python.org/mailman/listinfo/python-list
generator/coroutine terminology
This is more a question about standard terminology/conventions than about semantics - of course assuming I understand :-) Say I have a simple yielding function: def foo(x): yield x+1 yield x+2 And I have g = foo(2) If I look at type, g's type is 'generator' whereas foo is just plain-ol 'function.' Whereas in informal usage we say foo is a generator. So the question: What should we call foo and what should we call g? Same applies when foo is a 'coroutine' ie something having yield used in an rhs and used with '.send' from outside: What to call foo and what to call foo(x)? -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
On Fri, Mar 13, 2015 at 12:35 AM, Rustom Mody wrote: > If I look at type, g's type is 'generator' whereas foo is just plain-ol > 'function.' > > Whereas in informal usage we say foo is a generator. > > So the question: > What should we call foo and what should we call g? g is a generator object; foo is a generator function - a function which returns generator objects. Usually, calling both of them "generators" isn't confusing, as there's not often any context in which they're ambiguous. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
On Thursday, March 12, 2015 at 1:35:48 PM UTC, Rustom Mody wrote: > This is more a question about standard terminology/conventions than about > semantics - of course assuming I understand :-) > > Say I have a simple yielding function: > > def foo(x): >yield x+1 >yield x+2 > > And I have > > g = foo(2) > > If I look at type, g's type is 'generator' whereas foo is just plain-ol > 'function.' > > Whereas in informal usage we say foo is a generator. > > So the question: > What should we call foo and what should we call g? > > Same applies when foo is a 'coroutine' ie > something having yield used in an rhs and used with '.send' from outside: > What to call foo and what to call foo(x)? Try the glossary https://docs.python.org/3/glossary.html If this comes out badly please free to shout as I'm on gg :) -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
Rustom Mody wrote: > This is more a question about standard terminology/conventions than about > semantics - of course assuming I understand :-) > > Say I have a simple yielding function: > > def foo(x): >yield x+1 >yield x+2 > > And I have > > g = foo(2) > > If I look at type, g's type is 'generator' whereas foo is just plain-ol > 'function.' > > Whereas in informal usage we say foo is a generator. Hopefully it is clear from context what we actually mean. When in doubt, we should be explicit. > So the question: > What should we call foo and what should we call g? foo is a generator function, i.e. a function which returns a generator. I'd also allow generator factory, naming it by intent rather than type. The result of calling foo, namely foo(x), which you have named g, is a generator object, which is a kind of iterator. > Same applies when foo is a 'coroutine' ie > something having yield used in an rhs and used with '.send' from outside: > What to call foo and what to call foo(x)? foo is a generator function, and foo(x) is a generator object. In this case we can call foo(x) by usage rather than type, and call it a coroutine. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
Guess I should be pleased that I am doing as good as you (and Chris) describe. For some reason or not I am not... On Thursday, March 12, 2015 at 9:58:07 PM UTC+5:30, Steven D'Aprano wrote: > Rustom Mody wrote: > > > This is more a question about standard terminology/conventions than about > > semantics - of course assuming I understand :-) > > > > Say I have a simple yielding function: > > > > def foo(x): > >yield x+1 > >yield x+2 > > > > And I have > > > > g = foo(2) > > > > If I look at type, g's type is 'generator' whereas foo is just plain-ol > > 'function.' > > > > Whereas in informal usage we say foo is a generator. > > Hopefully it is clear from context what we actually mean. When in doubt, we > should be explicit. There is a very important 'context' where both have to exist together -- teaching beginners. foo's are written to produce g's. g's come from foo-like. Better naming would help clarify -- your 'factory' is the best Ive seen so far. But the docs?!?! Hoo Boy My head spins trying to grok this https://docs.python.org/3/reference/expressions.html#generator-expressions And thats after being familiar with the origins of the idea in scheme/simula/CLU etc. Noobs could be forgiven for doing worse dont you think?? I guess we need 1. A clear ontology of the base concepts (which is a buzzword for nailed-down terminology) 2. Some neat pictures would sure help (me!) -- https://mail.python.org/mailman/listinfo/python-list
Re: when may sys.executable be empty
On 11/03/2015 18:15, Dave Angel wrote: . Just speculating, but how about when the main executable is not python at all, but it uses a DLL or .so file with Python interpreter. when I run a django wsgi.py using uwsgi sys.executable points at the uwsgi executable. To run subprocess etc I have to find the python that's parallel to uwsgi (works in a virtualenv at least). -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
Rustom Mody : > I guess we need > 1. A clear ontology of the base concepts (which is a buzzword for > nailed-down terminology) According to the documentation, a function whose definition contains a yield statement is a generator: Using a yield expression in a function’s body causes that function to be a generator. https://docs.python.org/3/reference/expressions.html#yield-exp ressions> generator A function which returns an iterator. https://docs.python.org/3/glossary.html#term-generator> Apparently, what we have here is a discrepancy between the documentation and the CPython implementation. In a word, it's a bug (somewhere). Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
On Thu, 12 Mar 2015 22:29:24 +1100, Steven D'Aprano wrote: > >I would have a loadfile() method which takes a filename on disk, opens the >file and passes the contents (or the open file object) to another method, >load() to do the actual work: > > >class Map: >def __new__(cls, width, height, fill, treasure=None): ># Include additional args as needed. >map = super().__new__.(cls) >map.width = width >map.height = height >map.fill = fill >map.treasure = treasure >return map > >@classmethod >def loadfile(cls, filename): >with open(filename, 'r') as f: >map = cls.load(f) >return map > >@classmethod >def load(cls, f): ># validate and parse file contents ># extract width, height, fill, etc. >map = cls(width, height, fill, treasure) >return map > > >To get an empty map, you pass the load method a file-like object that >contains whatever an empty map data file will contain. That could literally >be an external file, if you so choose, or you could simply read it from a >global constant or even an embedded string/bytes object: > >@classmethod >def new(cls): >"""Return a new empty map.""" >emptymap = b"blah blah blah width=100 height=100 fill=1" >f = io.StringIO(emptymap) >return cls.load(f) > > >This, naturally, assumes that your map format is simple enough and small >enough that an empty map can be embedded into your code. If an empty map is >4MB on disk, you probably don't want to do this :-) > >Alternatively, set the default arguments to the __new__ constructor to be >whatever values an empty map uses: > >def __new__(cls, width=100, height=100, fill=1, treasure=None): >... > > >and now your "create empty map" command just calls Map() with no arguments. > Your solution is excelent! Leveraging the __new__ method is something I wasn't considering. It gracefully deals with the absence of __init__, not forcing me to raise an exception or document the class to warn against its use. Thanks a bunch. -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
On Thu, 12 Mar 2015 21:41:16 +1300, Gregory Ewing wrote: >Mario Figueiredo wrote: >> But PyCharm flags the assignment >> with a warning telling me that generate() does not return anything and >> the I lose code completion on the mmap variable. > >My guess is that there is a syntax error somewhere >in your code that's confusing the IDE. It's a PyCharm bug actually. Confirmed here: https://youtrack.jetbrains.com/issue/PY-11990 (sidenote: I wasn't finding that before. YouTrack search engine really needs to handle better word contractions. It was only when I was filling a bug report myself that it came up with that one in the list of possible related issues.) -- https://mail.python.org/mailman/listinfo/python-list
Python3 "pickle" vs. stdin/stdout - unable to get clean byte streams in Python 3
I have working code from Python 2 which uses "pickle" to talk to a subprocess via stdin/stdio. I'm trying to make that work in Python 3. First, the subprocess Python is invoked with the "-d' option, so stdin and stdio are supposed to be unbuffered binary streams. That was enough in Python 2, but it's not enough in Python 3. The subprocess and its connections are set up with proc = subprocess.Popen(launchargs,stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=env) ... self.reader = pickle.Unpickler(self.proc.stdout) self.writer = pickle.Pickler(self.proc.stdin, 2) after which I get result = self.reader.load() TypeError: 'str' does not support the buffer interface That's as far as traceback goes, so I assume this is disappearing into C code. OK, I know I need a byte stream. I tried self.reader = pickle.Unpickler(self.proc.stdout.buffer) self.writer = pickle.Pickler(self.proc.stdin.buffer, 2) That's not allowed. The "stdin" and "stdout" that are fields of "proc" do not have "buffer". So I can't do that in the parent process. In the child, though, where stdin and stdout come from "sys", "sys.stdin.buffer" is valid. That fixes the ""str" does not support the buffer interface error." But now I get the pickle error "Ran out of input" on the process child side. Probably because there's a str/bytes incompatibility somewhere. So how do I get clean binary byte streams between parent and child process? John Nagle -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
On 3/12/2015 9:35 AM, Rustom Mody wrote: This is more a question about standard terminology/conventions than about semantics - of course assuming I understand :-) Say I have a simple yielding function: def foo(x): yield x+1 yield x+2 This is a generator function And I have g = foo(2) If I look at type, g's type is 'generator' whereas foo is just plain-ol 'function.' Whereas in informal usage we say foo is a generator. I do not, because it does cause confusion, in spite of denials by people who use 'generator' ambiguously. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: __new__() does not return anything, on singletong pattern
On Thu, 12 Mar 2015 22:04:30 +1100, Steven D'Aprano wrote: > >3-4 seconds to instantiate is a bit worrying, but you should look at >improving the efficiency of loading a map rather than insisting that there >should be only one map instance. Particularly in the map editor, what if >the user wants to copy parts of one map into a second map? I've often >wanted to do that with games. Every other editor, from music editors to >text editors, allows you to have multiple documents open. Why should game >level editors be stuck in the 1980s? > >While Map is a singleton, editing multiple maps at once is impossible (or at >least tiresomely difficult). Those scnearios don't apply here. And the map editor isn't even a first-class application in the system. Just a patch to corrupt map files that will thus stand a chance to be recovered. I can understand your resistance to the idea of yet another singleton being born to this world. I myself despise the pattern. I think the GoF were drunk by the time they reached the Singleton. The whole Creational Patterns section was really only going downhill, anyways. Starts strong and ends up with the justin bieber of patterns. And I'm not using it because of some ulterior design principle. I don't plan to justify it because I have a *real* reason to use a singleton. I don't. I'm just using it because it is really accomodating for me to have this global without having to trace it around function calls arguments. That's evil. I suppose I could just make it really global. But to me that's even more evil and I can't consider it. Of course. What is a singleton today can't be twins tomorrow, triplets the day after and a crowd the next. I realize this. But... yeah... I'm a sinner. Besides it's not that I never had to revisit my code before because of Best Practices (tm). In truth the road to damnation starts when we decide to write our first line of code. -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
Terry Reedy : > On 3/12/2015 9:35 AM, Rustom Mody wrote: >> This is more a question about standard terminology/conventions than >> about semantics - of course assuming I understand :-) >> >> Say I have a simple yielding function: >> >> def foo(x): >> yield x+1 >> yield x+2 > > This is a generator function Which in the official language specification is an elaborate synonym of a generator. Marko -- https://mail.python.org/mailman/listinfo/python-list
PSF news - BBC launches MicroBit
http://pyfound.blogspot.co.uk/2015/03/bbc-launches-microbit.html may be of interest to some of you. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
My emails are getting bounced?
I'm posting this here because I have no clue who the heck the mailing list manager is. I got this message: Your membership in the mailing list Python-ideas has been disabled due to excessive bounces The last bounce received from you was dated 12-Mar-2015. You will not get any more messages from this list until you re-enable your membership. You will receive 3 more reminders like this before your membership in the list is deleted. A quick Google shows: Find out why list mail to you is bouncing and correct the problem. You may be able to see a returned bounce by setting bounce_notify_owner_on_disable to Yes. This will cause Mailman to send the triggering bounce to the owner, but since that's you, it may bounce too. Is it possible for someone to set this up for my email on Python-ideas? Again, not sure who the manager is, so I'm sending this here. -- Ryan [ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong. http://kirbyfan64.github.io/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Python3 "pickle" vs. stdin/stdout - unable to get clean byte streams in Python 3
On 12Mar2015 12:55, John Nagle wrote: I have working code from Python 2 which uses "pickle" to talk to a subprocess via stdin/stdio. I'm trying to make that work in Python 3. First, the subprocess Python is invoked with the "-d' option, so stdin and stdio are supposed to be unbuffered binary streams. You shouldn't need to use unbuffered streams specificly. It should be enough to .flush() the output stream (at whichever end) after you have written the pickle data. I'm skipping some of your discussion; I can see nothing wong. I don't use pickle itself so aside from saying that your use seems to conform to the python 3 doco I can't comment more deeply. That said, I do use subprocess a fair bit. [...] result = self.reader.load() TypeError: 'str' does not support the buffer interface That's as far as traceback goes, so I assume this is disappearing into C code. No line numbers at all? Or, I suppose, just the line number from your program and nothing from the pickle module? OK, I know I need a byte stream. I tried self.reader = pickle.Unpickler(self.proc.stdout.buffer) self.writer = pickle.Pickler(self.proc.stdin.buffer, 2) You should not need to care about these. They're not required. That's not allowed. The "stdin" and "stdout" that are fields of "proc" do not have "buffer". So I can't do that in the parent process. In the child, though, where stdin and stdout come from "sys", "sys.stdin.buffer" is valid. But irrelevant. Besides, the stream buffer may not contain the whole pickle data anyway; it will be empty before a read and quite possibly incomplete afterwards. It is just a buffer. That fixes the ""str" does not support the buffer interface error." I'm not sure "fix" is the right characterisation here. But now I get the pickle error "Ran out of input" on the process child side. Probably because there's a str/bytes incompatibility somewhere. No, probably because the buffer is only ever a snapshot of part of the stream. str/bytes errors are more glaringly obviously so. So how do I get clean binary byte streams between parent and child process? This is where I'm confused: my experience is that Popen.subprocess gives you binary streams; I always need to put an encoder/decoder on them to use text. Did that just the other day. BTW, this is on some UNIX variant? Should not be very relevant... Further questions: What does self.proc.stdout.__class__ say? And for stdin? Cheers, Cameron Simpson My opinions are borrowed from someone who no longer needs them. -- katma...@uga.cc.uga.edu -- https://mail.python.org/mailman/listinfo/python-list
Re: Python3 "pickle" vs. stdin/stdout - unable to get clean byte streams in Python 3
John Nagle wrote: > I have working code from Python 2 which uses "pickle" > to talk to a subprocess via stdin/stdio. I'm trying to > make that work in Python 3. > > First, the subprocess Python is invoked with the "-d' option, > so stdin and stdio are supposed to be unbuffered binary streams. > That was enough in Python 2, but it's not enough in Python 3. > > The subprocess and its connections are set up with > > proc = subprocess.Popen(launchargs,stdin=subprocess.PIPE, > stdout=subprocess.PIPE, env=env) > > ... > self.reader = pickle.Unpickler(self.proc.stdout) > self.writer = pickle.Pickler(self.proc.stdin, 2) > > after which I get > > result = self.reader.load() > TypeError: 'str' does not support the buffer interface > > That's as far as traceback goes, so I assume this is > disappearing into C code. > > OK, I know I need a byte stream. I tried > > self.reader = pickle.Unpickler(self.proc.stdout.buffer) > self.writer = pickle.Pickler(self.proc.stdin.buffer, 2) > > That's not allowed. The "stdin" and "stdout" that are > fields of "proc" do not have "buffer". So I can't do that > in the parent process. In the child, though, where > stdin and stdout come from "sys", "sys.stdin.buffer" is valid. > That fixes the ""str" does not support the buffer interface > error." But now I get the pickle error "Ran out of input" > on the process child side. Probably because there's a > str/bytes incompatibility somewhere. > > So how do I get clean binary byte streams between parent > and child process? I don't know what you have to do to rule out deadlocks when you use pipes for both stdin and stdout, but binary streams are the default for subprocess. Can you provide a complete example? Anyway, here is a demo for two-way communication using the communicate() method: $ cat parent.py import pickle import subprocess data = (5, 4.3, "üblich ähnlich nötig") p = subprocess.Popen( ["python3", "child.py"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) result = p.communicate(pickle.dumps(data, protocol=2))[0] print(pickle.loads(result)) $ cat child.py import sys import pickle a, b, c = pickle.load(sys.stdin.buffer) pickle.dump((a, b, c.upper()), sys.stdout.buffer) $ python3 parent.py (5, 4.3, 'ÜBLICH ÄHNLICH NÖTIG') This is likely not what you want because here everything is buffered so that continuous interaction is not possible. -- https://mail.python.org/mailman/listinfo/python-list
Re: My emails are getting bounced?
On 12/03/2015 21:56, Ryan Gonzalez wrote: I'm posting this here because I have no clue who the heck the mailing list manager is. If you look at the bottom of this page: https://mail.python.org/mailman/listinfo/python-ideas you can see the list maintainers which is also a mailto: link which will reach them all. Hopefully they can look at the setup for your user over there. TJG -- https://mail.python.org/mailman/listinfo/python-list
Re: My emails are getting bounced?
On Fri, Mar 13, 2015 at 8:56 AM, Ryan Gonzalez wrote: > > Your membership in the mailing list Python-ideas has been disabled due > to excessive bounces The last bounce received from you was dated > 12-Mar-2015. You will not get any more messages from this list until > you re-enable your membership. You will receive 3 more reminders like > this before your membership in the list is deleted. I also got this notification, and in the past, it's been because Gmail mishandles spam - bouncing it instead of either accepting or discarding it. The post gets handed between Gmail and Mailman until one of them gives up, and in this case, it's Mailman. It may be that that's what happened again. (Irony would be if the post originated from Google Groups, which would mean it got past the Google spam filter on one side, but tripped the filter on the other side.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: My emails are getting bounced?
On Thursday, March 12, 2015 at 5:01:46 PM UTC-5, Tim Golden wrote: > On 12/03/2015 21:56, Ryan Gonzalez wrote: > > I'm posting this here because I have no clue who the heck the mailing > > list manager is. > > If you look at the bottom of this page: > > https://mail.python.org/mailman/listinfo/python-ideas > > you can see the list maintainers which is also a mailto: link which will > reach them all. Hopefully they can look at the setup for your user over > there. > > TJG Ok; I'm emailing now. I didn't even get this message. I had to go to the Google Groups interface to check for replies. -- https://mail.python.org/mailman/listinfo/python-list
Google Code Shutting Down
I've been hosting Python projects on Google Code, and they're shutting down. Damn. What is the recommended replacement for Code Hosting that works reliably with PyPi and pip? -- https://mail.python.org/mailman/listinfo/python-list
Re: My emails are getting bounced?
On Thursday, March 12, 2015 at 5:09:16 PM UTC-5, Chris Angelico wrote: > On Fri, Mar 13, 2015 at 8:56 AM, Ryan Gonzalez wrote: > > > > Your membership in the mailing list Python-ideas has been disabled due > > to excessive bounces The last bounce received from you was dated > > 12-Mar-2015. You will not get any more messages from this list until > > you re-enable your membership. You will receive 3 more reminders like > > this before your membership in the list is deleted. > > I also got this notification, and in the past, it's been because Gmail > mishandles spam - bouncing it instead of either accepting or > discarding it. The post gets handed between Gmail and Mailman until > one of them gives up, and in this case, it's Mailman. It may be that > that's what happened again. (Irony would be if the post originated > from Google Groups, which would mean it got past the Google spam > filter on one side, but tripped the filter on the other side.) > > ChrisA Ugh. I love Gmail, but this sucks. -- https://mail.python.org/mailman/listinfo/python-list
Re: Google Code Shutting Down
On Thu, 12 Mar 2015 15:26:08 -0700 (PDT), Josh English wrote: >I've been hosting Python projects on Google Code, and they're shutting down. > >Damn. > >What is the recommended replacement for Code Hosting that works reliably with >PyPi and pip? Essentially anywhere where either Git, Bazaar, Mercurial or Subversion are supported. See: https://pip.pypa.io/en/latest/reference/pip_install.html#vcs-support -- https://mail.python.org/mailman/listinfo/python-list
Re: Python3 "pickle" vs. stdin/stdout - unable to get clean byte streams in Python 3
On 3/12/2015 2:56 PM, Cameron Simpson wrote: > On 12Mar2015 12:55, John Nagle wrote: >> I have working code from Python 2 which uses "pickle" to talk to a >> subprocess via stdin/stdio. I'm trying to make that work in Python >> 3. First, the subprocess Python is invoked with the "-d' option, so >> stdin and stdio are supposed to be unbuffered binary streams. > > You shouldn't need to use unbuffered streams specifically. It should > be enough to .flush() the output stream (at whichever end) after you > have written the pickle data. Doing that. It's a repeat-transaction thing. Main process sends pickeled item to subprocess, subprocess reads item, subprocess does work, subprocess writes picked item to parent. This repeats. I call writer.clear_memo() and set reader.memo = {} at the end of each cycle, to clear Pickle's cache. That all worked fine in Python 2. Are there any known problems with reusing Python 3 "pickle"s streams? The identical code works with Python 2.7.9; it's converted to Python 3 using "six" so I can run on both Python versions and look for differences. I'm using Pickle format 2, for compatibility. (Tried 0, the ASCII format; it didn't help.) > I'm skipping some of your discussion; I can see nothing wrong. I > don't use pickle itself so aside from saying that your use seems to > conform to the python 3 docs I can't comment more deeply. That said, > I do use subprocess a fair bit. I'll have to put in more logging and see exactly what's going over the pipes. John Nagle -- https://mail.python.org/mailman/listinfo/python-list
Re: My emails are getting bounced?
On Thu, Mar 12, 2015 at 4:56 PM, Ryan Gonzalez wrote: > Your membership in the mailing list Python-ideas has been disabled due > to excessive bounces I got the same treatment. Probably a mail loop involving Gmail. Skip -- https://mail.python.org/mailman/listinfo/python-list
Code hosting providers (was: Google Code Shutting Down)
Mario Figueiredo writes: > On Thu, 12 Mar 2015 15:26:08 -0700 (PDT), Josh English > wrote: > > > What is the recommended replacement for Code Hosting that works > > reliably with PyPi and pip? > > Essentially anywhere where either Git, Bazaar, Mercurial or Subversion > are supported. Installing directly from whatever the latest revision in VCS, is not a good replacement. What's needed is a VCS hosting provider that also expects you to publish tarballs at specific versions. For that, you want to choose a provider that runs entirely free software for the service – not just the VCS, but whatever other features you use need to be freely available for someone to run another instance of the same service. Otherwise you're stuck any time you want to migrate your project, which is what led to this thread in the first place. This is called “vendor lock-in”: services like GitHub and Google Code lock you in to the one provider, because if you want to migrate you can't take your project data (not just VCS but also issues, merge requests, etc.) with you to continue somewhere else. Any service which doesn't run their service on free software is one to avoid http://mako.cc/writing/hill-free_tools.html>; free software projects need free tools to remain that way. GitLab https://about.gitlab.com/> is a good option: they provide VCS, file hosting, wiki, issue tracker, code review via merge requests, etc. and all of it can be migrated to any other instance of the same service. Also worth watching is Kallithea, a new federated code hosting service https://kallithea-scm.org/>. It supports Mercurial and Git for VCS, code review, and integrates with existing issue trackers. Because it's federated, you won't suffer from vendor lock-in. Good hunting in finding a free-software code hosting provider for your projects! -- \ “I knew things were changing when my Fraternity Brothers threw | `\ a guy out of the house for mocking me because I'm gay.” | _o__) —postsecret.com, 2010-01-19 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
On Thursday, March 12, 2015 at 11:25:32 PM UTC+5:30, Marko Rauhamaa wrote: > Rustom Mody : > > > I guess we need > > 1. A clear ontology of the base concepts (which is a buzzword for > > nailed-down terminology) > > According to the documentation, a function whose definition contains a > yield statement is a generator: > >Using a yield expression in a function's body causes that function to >be a generator. > >https://docs.python.org/3/reference/expressions.html#yield-exp >ressions> > >generator > A function which returns an iterator. > >https://docs.python.org/3/glossary.html#term-generator> > > Apparently, what we have here is a discrepancy between the documentation > and the CPython implementation. > > In a word, it's a bug (somewhere). Throwing out some thought for better terminology. [Yeah needs to be chewed on a bit...] With respect to my example above: def foo(x): yield x+1 yield x+2 g = foo(2) Generator-instance: g Generator-factory: foo Generator: Concept in python (ontology) elaborated in terms of the above Situation with coroutines is worse [Or I cant think of good terms...] -- https://mail.python.org/mailman/listinfo/python-list
Re: My emails are getting bounced?
rym...@gmail.com wrote: > I didn't even get this message. I had to go to the Google Groups interface > to check for replies. Have you checked your junk mail folder? Unfortunately, the three of the Big Four mail providers -- Yahoo, Gmail, and AOL[1] -- have collectively decided that mailing lists are oh-so-2012 and are putting in place policies which make it harder and harder for their users to successfully subscribe and post to mailing lists. Ironically, Hotmail is probably the best of the Big Four in this regard. I don't even think it is a conscious decision that mailing lists are obsolete, I think it's mostly just technical incompetence and malice. Apparently Yahoo and AOL got hacked a few years ago, the bad guys managed to send out masses of spam via their mail servers, and they panicked, over-reacted (or at least badly reacted) and implemented a half-arsed, badly thought out implementation of DMARC which effectively makes it all but impossible for Yahoo/AOL users to use mailing lists. I've been told that Yahoo basically treats all bulk email as spam unless it comes from Yahoo itself. And of course Gmail and Google Groups make it hard to interoperate with the rest of Usenet and non-Google mailing lists. They don't have the excuse of technical incompetence. It's ironic that as Microsoft has slowly but surely (and kicking and screaming most of the way) become a better web citizen, Google's motto "Don't Be Evil" has become a sad joke more often than not. [1] Hard to believe, but yes people do still use AOL. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Code hosting providers (was: Google Code Shutting Down)
Ben Finney wrote: > Also worth watching is Kallithea, a new federated code hosting service > https://kallithea-scm.org/>. It supports Mercurial and Git for VCS, > code review, and integrates with existing issue trackers. Because it's > federated, you won't suffer from vendor lock-in. What do you mean by "federated"? -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Code hosting providers
On 03/12/2015 09:17 PM, Steven D'Aprano wrote: > Ben Finney wrote: >> Also worth watching is Kallithea, a new federated code hosting service >> https://kallithea-scm.org/>. It supports Mercurial and Git for VCS, >> code review, and integrates with existing issue trackers. Because it's >> federated, you won't suffer from vendor lock-in. > > What do you mean by "federated"? I think it's a fancy way of saying you can run your own instance of the full web system on your own server under your own domain name. -- https://mail.python.org/mailman/listinfo/python-list
KB 2670838 - The EVIL UPDATE
KB 2670838 - The EVIL UPDATE This Windows 7 update wasted a lot of my time today. I could not find my own postings in the past... maybe I was unsure in the past... I am still unsure today.. but much more sure than previously. When installing IE11 I suspect this patch also gets installed. This patch will cause: 1. Windows Live Mail fail to crash, making mail inaccessible. 2. Company of Heroes, Tales of Valor to crash. 3. Call of Duty 5 World at War to stop loading. 4. Possibly even IE9 to keep crashing... 5. And perhaps other misschief. This patch is the worst patch I have ever seen... I am not 100% sure but it's a very good guess. Therefore it's time for me to spam this message all across usenet... so that I will always find it in google hopefully, next time it pops it's ugly head... Hopefully it will save my lost of time in the future. Also bare in mind: IE9 crashes IE10,IE11 is junk, it's slow... it's laggy and it's not worth this patch trouble. My advice is stick with Firefox and other browsers... always make sure to have multiple browsers installed otherwise you might be stranded... Also if you ever have a crashing internet explorer and you really can't recover... remember that you can de-install it... this will revert it back to IE8... at least that should give you a chance to become "unstranded" and access the web again for help. KB 2670838 - The EVIL UPDATE http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_update/kb-2670838-the-evil-update/08bfdb2b-6896-4c34-89c2-16896a25dc3d I was hoping Microsoft fixed this patch by now... unfortunately they did not... and are probably too busy messing around with windows 8.1/windows 10 etc. Shame on them cause this is ONE BITCH OF A PATCH !!! Also FUCK Microsoft for intentionally DAMAGING computer software ! My trust in Microsoft is disappearing. Their behaviour is always the same basically: "Damage old software to try and get people to buy new systems/upgrade". This patch makes me sick to my stomach... mostly because it endangers my data ! If Microsoft causes my DATA to be lost or inaccessable their software will be TERMINATED by me and I will switch to something else. Even if it's just a stupid little patch like this... this kind of thing making my mail archieve inaccessible is unacceptable behaviour. I will keep a close eye on this patch to see if it ever gets fixed. If now I may get so sick to my stumach that I might just skip Windows 10 and go to Linux route... For now at least it can be deinstalled... but it comes at a great risk: no more internet explorer, no more internet explorer updates... Now I have to trust Mozilla and Open Source developers ?! What's the world coming too ?! ;) ;) ;) If Microsoft keeps this up they will drive everybody to open source... is that what you want Microsoft ? You guys are doing really bad right now... one little patch and you can't fix it REally ??? I will examine your details about this patch... I probably did it n the past already... You know what I will do it right now... just to see if I can add some info to this posting. Basically this is some kind of graphics patch update for hybrid graphics cards... fuck that... please shove this up your ass. Integrated graphics probably HHH WHERE HAVE I HEAR THAT BEFORE DOES INTEL WRING A BE ? INTEGRATED ELECTRONICS = INTEL. This patch is apperently CODE-AUTHORED BY INTEL. INTEL IS PURPOSELY NUKING YOUR SYSTEMS. THIS PUTS A NEW PERSPECTIVE ON INTEL. I WAS PLANNING TO BUY THEIR NEW SKYLAKE PROCESSOR... THOUGH THEIR HASWELL HAD A TRANSACTIONAL MEMORY BUG. THIS LATEST RELEVATION/CONCLUSION SHEDS NEW LIGHT ON THIS POTENTIAL EVIL FROM INTEL. I can only advice researchers, academics, hackers, press... to investigate this matter further. IF THIS IS TRUE THEN THIS IS A GIGANTIC SCHANDAL OF IMAGINABLE PROPORTIONS AND NEEDS A SEVERE COUNTER REACTION. IF THIS IS TRUE I CAN RECOMMEND A BOYCOTT OF INTEL PROCESSORS AND MICROSOFT SOFTWARE AND SWITCH TO OPEN SOURCE SOFTWARE where these kind of trust issues and bugs can be more easily spotted and fixed and hopefully AVOIDED. Basically I DEMAND A FULL INVESTIGATION from the goverments INTO PATCH 2670838. GOODBYE, FAILURE TO DO SO PUTS YOUR SYSTEMS AT RISK ! Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
Rustom Mody wrote: > On Thursday, March 12, 2015 at 11:25:32 PM UTC+5:30, Marko Rauhamaa wrote: >> Rustom Mody : >> >> > I guess we need >> > 1. A clear ontology of the base concepts (which is a buzzword for >> > nailed-down terminology) >> >> According to the documentation, a function whose definition contains a >> yield statement is a generator: >> >>Using a yield expression in a function's body causes that function to >>be a generator. >> >>https://docs.python.org/3/reference/expressions.html#yield-exp >>ressions> >> >>generator >> A function which returns an iterator. >> >>https://docs.python.org/3/glossary.html#term-generator> >> >> Apparently, what we have here is a discrepancy between the documentation >> and the CPython implementation. >> >> In a word, it's a bug (somewhere). > > Throwing out some thought for better terminology. > [Yeah needs to be chewed on a bit...] > > With respect to my example above: > > def foo(x): >yield x+1 >yield x+2 > > > g = foo(2) > > Generator-instance: g > Generator-factory: foo > Generator: Concept in python (ontology) elaborated in terms of the above I think that is is reasonable. I would include "generator function" as a synonym for generator factory. (Factories are more inclusive than functions -- a factory could include a class with a "make_generator" method, for example.) Where the distinction is clear, or not important, than calling both g and foo "generators" is acceptable shorthand. I realise that can be confusing to beginners, but jargon often is confusing to beginners until they have learned enough to be able to correctly interpret things in context. > Situation with coroutines is worse > [Or I cant think of good terms...] Not really. The difference between a coroutine and a generator is mostly in usage, that is, intent. They both use the same type, they both have send methods, they both are generated the same way. If you are foolish, you can even mix generator-behaviour and coroutine-behaviour in the same function: py> def g(): ... yield 1 ... yield 2 ... x = yield 3 ... yield x + 1000 ... py> a = g() py> next(a) 1 py> next(a) 2 py> next(a) 3 py> a.send(99) 1099 But don't do that. So as far as Python is concerned, a coroutine is just a generator instance which you use in a particular way, not a different kind of object. So I would use similar terminology: A generator function/factory returns a generator instance, which we use as a coroutine, so we can call it a coroutine. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Code hosting providers
Steven D'Aprano writes: > Ben Finney wrote: > > > Also worth watching is Kallithea, a new federated code hosting service > > https://kallithea-scm.org/>. It supports Mercurial and Git for VCS, > > code review, and integrates with existing issue trackers. Because it's > > federated, you won't suffer from vendor lock-in. > > What do you mean by "federated"? A service is federated if an independent, perhaps even competing, vendor can provide the same service and all users of the service participate, moving freely from one vendor to another as they choose without losing any of their data or identity. Another term is “decentralised”, though that says only what the service is not. I prefer the term “federated” because it describes what the service *is*: composed of multiple parties, collaborating on equal terms enforced for the protection of the people participating in the service. If a service's features use proprietary protocols or undisclosed APIs or in any other way make it infeasible for a user joining today to reliably migrate their accumulated data to a different vendor at some future time, then that service is not federated and its users are vulnerable to vendor lock-in. The email system, for example, is federated: my data can reliably (and has, several times) survive migration to any vendor who provides standard email service, because I lose no access to any of my history or identity or accumulated data or access or ongoing functionality with the same data. By “reliably” I mean that I can move it all from one vendor to another, and even back again if I choose, in the knowledge that the standard POP, IMAPv4, and SMTP protocols will be honoured, because to fail in that would be a bug severe enough that the vendor would be avoided as not providing the service. Other examples of federated systems include: * Avatar image serving: Libravatar https://www.libravatar.org/>. * Social networking: Diaspora https://joindiaspora.com/>. * Version control: Git http://git-scm.com/>. * The World Wide Web, and the internet as originally designed http://www.theguardian.com/technology/2012/sep/05/tim-berners-lee-internet-off-switch>. To the extent that vendor lock-in is possible, the service is not federated. Corollary: some features of a vendor's offerings can be federated, and others not; and to talk of the vendor's complete set of offerings as “federated” can only be true if they all are. The GitHub service, for example, is not federated, because while mere Git repositories *are* federated, significant GitHub features (issue tracker, pull requests, and other important history and project data) cannot reliably be migrated smoothly to another instance provided by a competing vendor. Ned Batchelder and Nick Coghlan have written insightfully on this http://nedbatchelder.com/blog/201405/github_monoculture.html> https://mail.python.org/pipermail/python-dev/2014-November/137153.html> with regard to why GitHub – or any non-federated service – is not a good option for projects that intend to stay viable. It will be good to see Kallithea https://kallithea-scm.org/> come into its own; until then we have GitLab https://about.gitlab.com/> and Redmine https://www.redmine.org/> and even the juggernaut of Launchpad https://launchpad.net/>; they are all federated and avoid vendor lock-in. We should ask hard questions to projects that choose to host their irreplaceable data – not just VCS but issues, user identities, discussions, documentation, etc. – on services that they can't reliably migrate from. They are demonstrating they don't intend to be around for long; why should we invest any effort in them? -- \ “The most common way people give up their power is by thinking | `\ they don't have any.” —Alice Walker | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Code hosting providers
Michael Torrie writes: > On 03/12/2015 09:17 PM, Steven D'Aprano wrote: > > What do you mean by "federated"? > > I think it's a fancy way of saying you can run your own instance of the > full web system on your own server under your own domain name. With the corollary that *any* vendor motivated to do so can serve the same function. Meaning the options aren't just “use this vendor or get nothing”, as they are with a centralised service. With a federated service, anyone *can* run their own instance, which means that few people have to: vendors can pop up and compete with one another, participants have the option of moving to a different vendor taking their data and functionality and established relationships and discussions and identity where they choose. -- \ “The aim of science is not to open the door to infinite wisdom, | `\but to set some limit on infinite error.” —Bertolt Brecht, | _o__)_Leben des Galilei_, 1938 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Google Code Shutting Down
On Thu, Mar 12, 2015 at 4:26 PM, Josh English wrote: > I've been hosting Python projects on Google Code, and they're shutting down. > > Damn. > > What is the recommended replacement for Code Hosting that works reliably with > PyPi and pip? Google has been migrating most of its own open source projects to GitHub. -- https://mail.python.org/mailman/listinfo/python-list
Re: Code hosting providers
Ben Finney writes: > Any service which doesn't run their service on free software is one to > avoid http://mako.cc/writing/hill-free_tools.html>; free software > projects need free tools to remain that way. > > GitLab https://about.gitlab.com/> is a good option: they provide > VCS, file hosting, wiki, issue tracker, code review via merge requests... > Also worth watching is Kallithea, a new federated code hosting service > https://kallithea-scm.org/>. It supports Mercurial and Git for VCS, > code review, and integrates with existing issue trackers. Because it's > federated, you won't suffer from vendor lock-in. Thanks for that informative post: I've been uncomfortable with the reach of Github and you've done a good job explaining the reasons. I personally use self-hosted git repositories on cheap VPS servers which is easy to do, but doesn't supply issue tracking. I know various projects that use either Trac or Bugzilla but I haven't tried operating those. One interesting and very lightweight alternative is Fossil, which is an all-in-one program that does lots of the same stuff as Git, Trac, a web server, and a wiki, all rolled into a single C program that uses about 1 meg of ram. It's written by the guy who wrote SQLite and it in fact uses SQLite as the underlying data store. It has a philosophical difference with git in that it's difficult to "rewrite history" which some workflows expect you to do. I've sometimes wondered how difficult it would be to modify Fossil to support that feature. -- https://mail.python.org/mailman/listinfo/python-list
Re: generator/coroutine terminology
On Friday, March 13, 2015 at 9:00:17 AM UTC+5:30, Steven D'Aprano wrote: > Rustom Mody wrote: > > > On Thursday, March 12, 2015 at 11:25:32 PM UTC+5:30, Marko Rauhamaa wrote: > >> Rustom Mody : > >> > >> > I guess we need > >> > 1. A clear ontology of the base concepts (which is a buzzword for > >> > nailed-down terminology) > >> > >> According to the documentation, a function whose definition contains a > >> yield statement is a generator: > >> > >>Using a yield expression in a function's body causes that function to > >>be a generator. > >> > >>https://docs.python.org/3/reference/expressions.html#yield-exp > >>ressions> > >> > >>generator > >> A function which returns an iterator. > >> > >>https://docs.python.org/3/glossary.html#term-generator> > >> > >> Apparently, what we have here is a discrepancy between the documentation > >> and the CPython implementation. > >> > >> In a word, it's a bug (somewhere). > > > > Throwing out some thought for better terminology. > > [Yeah needs to be chewed on a bit...] > > > > With respect to my example above: > > > > def foo(x): > >yield x+1 > >yield x+2 > > > > > > g = foo(2) > > > > Generator-instance: g > > Generator-factory: foo > > Generator: Concept in python (ontology) elaborated in terms of the above > > I think that is is reasonable. Good that we agree! > Where the distinction is clear, or not important, than calling both g and > foo "generators" is acceptable shorthand. I realise that can be confusing > to beginners, but jargon often is confusing to beginners until they have > learned enough to be able to correctly interpret things in context. I would prefer -- when shortforming is required: generator-instance -> instance generator-factory -> factory rather than generator-instance -> generator generator-factory -> generator Yeah that can quarrel with the more usual OO notion of instance, but I find that ambiguity more remote > > > > Situation with coroutines is worse > > [Or I cant think of good terms...] > > Not really. The difference between a coroutine and a generator is mostly in > usage, that is, intent. They both use the same type, they both have send > methods, they both are generated the same way. If you are foolish, you can > even mix generator-behaviour and coroutine-behaviour in the same function: > > > py> def g(): > ... yield 1 > ... yield 2 > ... x = yield 3 > ... yield x + 1000 > ... > py> a = g() > py> next(a) > 1 > py> next(a) > 2 > py> next(a) > 3 > py> a.send(99) > 1099 > > But don't do that. > > So as far as Python is concerned, a coroutine is just a generator instance > which you use in a particular way, not a different kind of object. So I > would use similar terminology: > > A generator function/factory returns a generator instance, which we use as a > coroutine, so we can call it a coroutine. I think coroutines are intended to be symmetric in a way that generators are not. The nut-n-bolts of both may involve using yield but conceptually I find them different. And even there I would expect generators to close with StopIteration Whereas I would expect coroutines to close (on close method) with GeneratorExit [Ive not thought all this through properly so may be off the mark] -- https://mail.python.org/mailman/listinfo/python-list
Re: Python3 "pickle" vs. stdin/stdout - unable to get clean byte streams in Python 3
On 3/12/2015 5:18 PM, John Nagle wrote: > On 3/12/2015 2:56 PM, Cameron Simpson wrote: >> On 12Mar2015 12:55, John Nagle wrote: >>> I have working code from Python 2 which uses "pickle" to talk to a >>> subprocess via stdin/stdio. I'm trying to make that work in Python >>> 3. I'm starting to think that the "cpickle" module, which Python 3 uses by default, has a problem. After the program has been running for a while, I start seeing errors such as File "C:\projects\sitetruth\InfoSiteRating.py", line 200, in scansite if len(self.badbusinessinfo) > 0 : # if bad stuff NameError: name 'len' is not defined which ought to be impossible in Python, and File "C:\projects\sitetruth\subprocesscall.py", line 129, in send self.writer.dump(args) # send data OSError: [Errno 22] Invalid argument from somewhere deep inside CPickle. I got File "C:\projects\sitetruth\InfoSiteRating.py", line 223, in get_rating_text (ratingsmalliconurl, ratinglargiconurl, ratingalttext) = DetailsPageBuilder.getratingiconinfo(rating) NameError: name 'DetailsPageBuilder' is not defined (That's an imported module. It worked earlier in the run.) and finally, even after I deleted all .pyc files and all Python cache directories: Fatal Python error: GC object already tracked Current thread 0x1a14 (most recent call first): File "C:\python34\lib\site-packages\pymysql\connections.py", line 411 in description File "C:\python34\lib\site-packages\pymysql\connections.py", line 1248 in _get_descriptions File "C:\python34\lib\site-packages\pymysql\connections.py", line 1182 in _read_result_packet File "C:\python34\lib\site-packages\pymysql\connections.py", line 1132 in read File "C:\python34\lib\site-packages\pymysql\connections.py", line 929 in _read_query_result File "C:\python34\lib\site-packages\pymysql\connections.py", line 768 in query File "C:\python34\lib\site-packages\pymysql\cursors.py", line 282 in _query File "C:\python34\lib\site-packages\pymysql\cursors.py", line 134 in execute File "C:\projects\sitetruth\domaincacheitem.py", line 128 in select File "C:\projects\sitetruth\domaincache.py", line 30 in search File "C:\projects\sitetruth\ratesite.py", line 31 in ratedomain File "C:\projects\sitetruth\RatingProcess.py", line 68 in call File "C:\projects\sitetruth\subprocesscall.py", line 140 in docall File "C:\projects\sitetruth\subprocesscall.py", line 158 in run File "C:\projects\sitetruth\RatingProcess.py", line 89 in main File "C:\projects\sitetruth\RatingProcess.py", line 95 in That's a definite memory error. So something is corrupting memory. Probably CPickle. All my code is in Python. Every library module came in via "pip", into a clean Python 3.4.3 (32 bit) installation on Win7/x86-64. Currently installed packages: beautifulsoup4 (4.3.2) dnspython3 (1.12.0) html5lib (0.999) pip (6.0.8) PyMySQL (0.6.6) pyparsing (2.0.3) setuptools (12.0.5) six (1.9.0) And it works fine with Python 2.7.9. Is there some way to force the use of the pure Python pickle module? My guess is that there's something about reusing "pickle" instances that botches memory uses in CPython 3's C code for "cpickle". John Nagle -- https://mail.python.org/mailman/listinfo/python-list