What do you think: good idea to launch a marketplace on python+django?

2016-12-01 Thread Gus_G
Hello, what do you think about building a marketplace website on connection of python+django? End effect-side should look and work similar to these: https://zoptamo.com/uk/s-abs-c-uk, https://www.ownerdirect.com/ . What are your opinions on this idea? Maybe there is other, better way to build it

Re: correct way to catch exception with Python 'with' statement

2016-12-01 Thread Steve D'Aprano
On Fri, 2 Dec 2016 11:26 am, DFS wrote: >> For most programs, yes, it probably will never be a problem to check >> for existence, and then assume that the file still exists.  But put that >> code on a server, and run it a couple of million times, with dozens of >> other processes also manipulating

Re: compile error when using override

2016-12-01 Thread Steve D'Aprano
On Fri, 2 Dec 2016 01:35 pm, Ho Yeung Lee wrote: > from __future__ import division > import ast > from sympy import * > x, y, z, t = symbols('x y z t') > k, m, n = symbols('k m n', integer=True) > f, g, h = symbols('f g h', cls=Function) > import inspect Neither ast nor inspect is used. Why impor

Re: correct way to catch exception with Python 'with' statement

2016-12-01 Thread Steve D'Aprano
On Fri, 2 Dec 2016 11:26 am, DFS wrote: > On 12/01/2016 06:48 PM, Ned Batchelder wrote: >> On Thursday, December 1, 2016 at 2:31:11 PM UTC-5, DFS wrote: >>> After a simple test below, I submit that the above scenario would never >>> occur. Ever. The time gap between checking for the file's exist

How to properly retrieve data using requests + bs4 from multiple pages in a site?

2016-12-01 Thread Juan C.
I'm a student and my university uses Moodle as their learning management system (LMS). They don't have Moodle Web Services enabled and won't be enabling it anytime soon, at least for students. The university programs have the following structure, for example: 1. Bachelor's Degree in Computer Scien

Re: correct way to catch exception with Python 'with' statement

2016-12-01 Thread Ned Batchelder
On Thursday, December 1, 2016 at 7:26:18 PM UTC-5, DFS wrote: > On 12/01/2016 06:48 PM, Ned Batchelder wrote: > > On Thursday, December 1, 2016 at 2:31:11 PM UTC-5, DFS wrote: > >> After a simple test below, I submit that the above scenario would never > >> occur. Ever. The time gap between check

Re: Request Help With Byte/String Problem

2016-12-01 Thread Wildman via Python-list
On Wed, 30 Nov 2016 14:39:02 +0200, Anssi Saari wrote: > There'll be a couple more issues with the printing but they should be > easy enough. I finally figured it out, I think. I'm not sure if my changes are what you had in mind but it is working. Below is the updated code. Thank you for not gi

Re: Request Help With Byte/String Problem

2016-12-01 Thread Wildman via Python-list
On Wed, 30 Nov 2016 07:54:45 -0500, Dennis Lee Bieber wrote: > On Tue, 29 Nov 2016 22:01:51 -0600, Wildman via Python-list > declaimed the following: > >>I really appreciate your reply. Your suggestion fixed that >>problem, however, a new error appeared. I am doing some >>research to try to fi

Re: compile error when using override

2016-12-01 Thread Ho Yeung Lee
from __future__ import division import ast from sympy import * x, y, z, t = symbols('x y z t') k, m, n = symbols('k m n', integer=True) f, g, h = symbols('f g h', cls=Function) import inspect def op2(a,b): return a*b+a class AA(object): @staticmethod def __additionFunction__(a

Re: correct way to catch exception with Python 'with' statement

2016-12-01 Thread Ned Batchelder
On Thursday, December 1, 2016 at 2:31:11 PM UTC-5, DFS wrote: > After a simple test below, I submit that the above scenario would never > occur. Ever. The time gap between checking for the file's existence > and then trying to open it is far too short for another process to sneak > in and dele

Re: Can json.dumps create multiple lines

2016-12-01 Thread Cecil Westerhof
On Thursday 1 Dec 2016 23:58 CET, Peter Otten wrote: > Cecil Westerhof wrote: > >> On Thursday 1 Dec 2016 22:52 CET, Cecil Westerhof wrote: >> >>> Now I need to convert the database. But that should not be a big >>> problem. >> >> I did the conversion with: >> cursor.execute('SELECT tipID FROM t

Re: Can json.dumps create multiple lines

2016-12-01 Thread Peter Otten
Cecil Westerhof wrote: > On Thursday 1 Dec 2016 22:52 CET, Cecil Westerhof wrote: > >> Now I need to convert the database. But that should not be a big >> problem. > > I did the conversion with: > cursor.execute('SELECT tipID FROM tips') > ids = cursor.fetchall() > for id in ids: >

Re: Error In querying Genderize.io. Can someone please help

2016-12-01 Thread John Gordon
In handa...@gmail.com writes: > import requests > import json > names={'katty','Shean','Rajat'}; > for name in names: > request_string="http://api.genderize.io/?"+name > r=requests.get(request_string) > result=json.loads(r.content) You're using http: instead of https:, and you're us

Re: Can json.dumps create multiple lines

2016-12-01 Thread Cecil Westerhof
On Thursday 1 Dec 2016 22:52 CET, Cecil Westerhof wrote: > Now I need to convert the database. But that should not be a big > problem. I did the conversion with: cursor.execute('SELECT tipID FROM tips') ids = cursor.fetchall() for id in ids: id = id[0] cursor.execute(

Re: Can json.dumps create multiple lines

2016-12-01 Thread Cecil Westerhof
On Thursday 1 Dec 2016 17:55 CET, Zachary Ware wrote: > On Thu, Dec 1, 2016 at 10:30 AM, Cecil Westerhof wrote: >> I would prefer when it would generate: >> '[ >> "An array", >> "with several strings", >> "as a demo" >> ]' >> >> Is this possible, or do I have to code this myself? > > https://doc

Error In querying Genderize.io. Can someone please help

2016-12-01 Thread handar94
import requests import json names={'katty','Shean','Rajat'}; for name in names: request_string="http://api.genderize.io/?"+name r=requests.get(request_string) result=json.loads(r.content) Error--- Traceback (most recent call last): File "C:/Users/user/PycharmProjects/untitle

Re: Can json.dumps create multiple lines

2016-12-01 Thread Tim Chase
On 2016-12-01 17:30, Cecil Westerhof wrote: > When I have a value dummy which contains: > ['An array', 'with several strings', 'as a demo'] > Then json.dumps(dummy) would generate: > '["An array", "with several strings", "as a demo"]' > I would prefer when it would generate: > '[ >

Re: Asyncio -- delayed calculation

2016-12-01 Thread Ian Kelly
On Thu, Dec 1, 2016 at 12:53 AM, Christian Gollwitzer wrote: > well that works - but I think it it is possible to explain it, without > actually understanding what it does behind the scences: > > x = foo() > # schedule foo for execution, i.e. put it on a TODO list This implies that if you never a

Re: OSError: [Errno 12] Cannot allocate memory

2016-12-01 Thread duncan smith
On 01/12/16 01:12, Chris Kaynor wrote: > On Wed, Nov 30, 2016 at 4:54 PM, duncan smith wrote: >> >> Thanks. So something like the following might do the job? >> >> def _execute(command): >> p = subprocess.Popen(command, shell=False, >> stdout=subprocess.PIPE, >>

Re: Can json.dumps create multiple lines

2016-12-01 Thread John Gordon
In <87lgvz4no8@equus.decebal.nl> Cecil Westerhof writes: > I started to use json.dumps to put things in a SQLite database. But I > think it would be handy when it would be easy to change the values > manually. > When I have a value dummy which contains: > ['An array', 'with several strin

Re: Can json.dumps create multiple lines

2016-12-01 Thread Zachary Ware
On Thu, Dec 1, 2016 at 10:30 AM, Cecil Westerhof wrote: > I would prefer when it would generate: > '[ > "An array", > "with several strings", > "as a demo" > ]' > > Is this possible, or do I have to code this myself? https://docs.python.org/3/library/json.html?highlight=in

Can json.dumps create multiple lines

2016-12-01 Thread Cecil Westerhof
I started to use json.dumps to put things in a SQLite database. But I think it would be handy when it would be easy to change the values manually. When I have a value dummy which contains: ['An array', 'with several strings', 'as a demo'] Then json.dumps(dummy) would generate: '["An array"

Re: The Case Against Python 3

2016-12-01 Thread Ned Batchelder
On Thursday, December 1, 2016 at 9:03:46 AM UTC-5, Paul Moore wrote: > While I agree that f-strings are more dangerous than people will immediately > realise (the mere fact that we call them f-*strings* when they definitely > aren't strings is an example of that), the problem here is clearly (IM

Re: The Case Against Python 3

2016-12-01 Thread Paul Moore
On Tuesday, 29 November 2016 01:01:01 UTC, Chris Angelico wrote: > So what is it that's trying to read something and is calling an > f-string a mere string? gettext.c2py: """Gets a C expression as used in PO files for plural forms and returns a Python lambda function that implements an e

Re: Merge Two List of Dict

2016-12-01 Thread Tim Chase
On 2016-12-01 12:44, Nikhil Verma wrote: > A = [{'person_id': '1', 'adop_count': '2'}, {'person_id': '3', > 'adop_count': '4'}] > *len(A) might be above 10L* > > B = [{'person_id': '1', 'village_id': '3'}, {'person_id': '3', > 'village_id': '4'}] > *len(B) might be above 20L* > > > OutPut List s

Re: compile error when using override

2016-12-01 Thread Steve D'Aprano
On Thu, 1 Dec 2016 05:26 pm, Ho Yeung Lee wrote: > import ast > from __future__ import division That's not actually your code. That will be a SyntaxError. Except in the interactive interpreter, "__future__" imports must be the very first line of code. > class A: >     @staticmethod >     def _

Fwd: Merge Two List of Dict

2016-12-01 Thread Nikhil Verma
Just editing the count it was from Indian place value notation. -- Forwarded message -- From: Nikhil Verma Date: Thu, Dec 1, 2016 at 12:44 PM Subject: Merge Two List of Dict To: python-list@python.org Hey guys What is the most optimal and pythonic solution forthis situation A

Re: Merge Two List of Dict

2016-12-01 Thread Peter Otten
Peter Otten wrote: > If the data stems from a database you can run (untested) > > select B.village_id, sum(A.adop_count) from A inner join B on A.person_id > = B.person_id; > Oops, I forgot the group-by clause: select B.village_id, sum(A.adop_count) from A inner join B on A.person_id = B.pers

Re: Merge Two List of Dict

2016-12-01 Thread Peter Otten
Nikhil Verma wrote: > Hey guys > > What is the most optimal and pythonic solution forthis situation > > A = [{'person_id': '1', 'adop_count': '2'}, {'person_id': '3', > 'adop_count': '4'}] > *len(A) might be above 10L* > > B = [{'person_id': '1', 'village_id': '3'}, {'person_id': '3', > 'villag