Re: revisiting the "What am I running on?" question
Terry Reedy wrote: > On 2/22/2019 7:55 AM, songbird wrote: >> eryk sun wrote: >> ... >>> The win-amd64 ABI is significantly different, but at the API level >>> there isn't a drastic difference between 32-bit and 64-bit Windows, so >>> there's no cognitive burden with perpetuating the Win32 name. The >>> official API name was actually changed to "Windows API" or WINAPI (or >>> WinAPI). But it would require a massive effort to change the culture. >>> There's no pressing need to expend that much time and energy over a >>> name. >> >>just adding a comment to the documentation that >> win32 also covers win64 would be a help IMO. > > Could you open an issue on the tracker suggesting a specific edit at a > specific place? yes, i will next week when i can get back to this. songbird -- https://mail.python.org/mailman/listinfo/python-list
Re: python3.7 installation failing - so why?
On 2/22/2019 10:56 PM, Chris Angelico wrote: On Sat, Feb 23, 2019 at 2:51 PM Frank Miles wrote: Question: how can I determine what has gone wrong? Hmm. I'd start with: $ which python3 $ dpkg -S `which python3` and from inside Python: >>> import sys; sys.path Adding ', sys.executable' is often handy and works on all systems with python. >>> import enum; enum.__file__ I should remember to suggest this when an import runs but the imported module does not work right. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: python3.7 installation failing - so why?
On Sun, Feb 24, 2019 at 4:44 AM Terry Reedy wrote: > > On 2/22/2019 10:56 PM, Chris Angelico wrote: > > On Sat, Feb 23, 2019 at 2:51 PM Frank Miles wrote: > > >> Question: how can I determine what has gone wrong? > > > > Hmm. I'd start with: > > > > $ which python3 > > $ dpkg -S `which python3` > > > > and from inside Python: > > >>> import sys; sys.path > > Adding ', sys.executable' is often handy and works on all systems with > python. True. Though I also was curious as to the package it came from (dpkg -S will tell you "oh, that file was installed from package XYZ"), and the OP did state that it was a Debian system ergo dpkg-managed. But for general questions, absolutely, sys.executable is handy. > > >>> import enum; enum.__file__ > > I should remember to suggest this when an import runs but the imported > module does not work right. > It's most often helpful when you get someone trying out regular expressions by writing a test file called "re.py" or something. :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Best way to (re)load test data in Mongo DB
Hi! I'm toying around with Pyramid and am using Mongo via MongoEngine for storage. I'm new to both Pyramid and MongoEngine. For every test case in the part of my suite that tests the data access layer I want to reload the database from scratch, but it feels like there should be a better and faster way than what I'm doing now. I have two distinct issues: 1. What's the fastest way of resetting the database to a clean state? 2. How do I load data with Mongo's internal _id being kept persistent? For issue #1: First of all I'd very much prefer to avoid having to use external client programs such as mongoimport to keep the number of dependencies minimal. Thus if there's a good way to do it through MongoEngine or PyMongo, that'd be preferable. My first shot at populating the database was simply to load data from a JSON file, use this to create my model objects (based on MongoEngine.Document) and save them to the DB. With a single-digit number of test cases and very limited data, this approach already takes close to a second, so I'm thinking there should be a faster way. It's Mongo, after all, not Oracle. My second version uses the underlying PyMongo module's insert_many() function to add all the documents for each collection in one go, but for this small amount of data it doesn't seem any faster. Which brings us to issue #2: For both of these strategies I'm unable to insert the Mongo ObjectId type _id. I haven't made _id properties part of my models, because they seem a bit... alien. I'd rather not include them solely to be able to load my test data properly. How can I populate _id as an ObjectId, not just as a string? (I'm assuming there's a difference, but it's never come up until now.) Am I being too difficult? I haven't been able to find much written about this topic: discussions about mocking drown out everything else the moment you mention 'mongo' and 'test' in the same search. Martin -- https://mail.python.org/mailman/listinfo/python-list