Deutsch English Français Italiano |
<mailman.15.1724900293.2917.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Thomas Passin <list1@tompassin.net> Newsgroups: comp.lang.python Subject: Re: Script stops running with no error Date: Wed, 28 Aug 2024 22:58:02 -0400 Lines: 170 Message-ID: <mailman.15.1724900293.2917.python-list@python.org> References: <87r0a8xskb.fsf@rpi3> <bb82f035-45dc-4c6f-aaec-b1e59ce825f7@tompassin.net> <0fec5175-e2a2-407a-9e09-c6901617b75c@DancesWithMice.info> <0a5b67d8-ba6f-4a15-b9e6-a9905e5a987e@tompassin.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de Hw1HhTyAl5VOykOBWAMndgJlrcWwZ4tMTk1ms2rSgVSg== Cancel-Lock: sha1:tdXgJeTmMbg6YH3Do2vFVotmvHA= sha256:iKGKZlv1dFwnu6FOKDX8ylWJfLtrmQSaXP7qQHysul8= Return-Path: <list1@tompassin.net> X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org Authentication-Results: mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=tompassin.net header.i=@tompassin.net header.b=kHKaRNIQ; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(which': 0.04; 'containing': 0.05; '(to': 0.07; 'matches': 0.07; 'subject:error': 0.07; 'approaches': 0.09; 'compute': 0.09; 'json': 0.09; 'ok,': 0.09; 'parse': 0.09; 'question:': 0.09; 'requests.': 0.09; 'url- ip:151.101.0.223/32': 0.09; 'url-ip:151.101.128.223/32': 0.09; 'url-ip:151.101.192.223/32': 0.09; 'url-ip:151.101.64.223/32': 0.09; 'steps': 0.11; 'import': 0.15; 'problem.': 0.15; '(more': 0.16; 'are.\xc2\xa0': 0.16; 'computation': 0.16; 'computers': 0.16; 'constant': 0.16; 'dictionary.': 0.16; 'hint': 0.16; 'intro': 0.16; 'outputting': 0.16; 'parsing': 0.16; 'pertinent': 0.16; 'printer': 0.16; 'pytest,': 0.16; 'queries.': 0.16; 'received:10.0.0': 0.16; 'received:64.90': 0.16; 'received:64.90.62': 0.16; 'received:64.90.62.162': 0.16; 'received:dreamhost.com': 0.16; 'script.': 0.16; 'slow': 0.16; 'splitting': 0.16; 'subject:running': 0.16; 'url:project': 0.16; 'url:pypi': 0.16; 'wikimedia': 0.16; 'wrote:': 0.16; 'problem': 0.16; 'python': 0.16; 'api': 0.17; 'pull': 0.17; 'probably': 0.17; "aren't": 0.19; 'pm,': 0.19; 'to:addr:python-list': 0.20; 'input': 0.21; 'code': 0.23; 'lines': 0.23; 'idea': 0.24; '(and': 0.25; 'discussion': 0.25; 'seems': 0.26; 'again,': 0.26; 'library': 0.26; "isn't": 0.27; 'leave': 0.27; 'function': 0.27; '>>>': 0.28; 'expect': 0.28; 'output': 0.28; 'settings': 0.28; 'example,': 0.28; 'ideas': 0.28; 'header:User-Agent:1': 0.30; 'seem': 0.31; 'approach': 0.31; 'url-ip:188/8': 0.31; 'think': 0.32; 'execution': 0.32; 'python-list': 0.32; 'received:10.0': 0.32; 'received:mailchannels.net': 0.32; 'received:relay.mailchannels.net': 0.32; 'skip:w 40': 0.32; 'structure': 0.32; 'but': 0.32; "i'm": 0.33; 'there': 0.33; 'able': 0.34; 'header:In-Reply-To:1': 0.34; 'complex': 0.35; 'functions': 0.36; 'those': 0.36; "skip:' 10": 0.37; 'main': 0.37; 'really': 0.37; 'using': 0.37; "it's": 0.37; 'file': 0.38; 'way': 0.38; 'could': 0.38; 'url-ip:151.101.0/24': 0.62; 'url- ip:151.101.128/24': 0.62; 'url-ip:151.101.192/24': 0.62; 'url- ip:151.101.64/24': 0.62; 'come': 0.62; 'once': 0.63; 'our': 0.64; 'research': 0.64; 'skip:r 20': 0.64; 'definition': 0.64; 'your': 0.64; 'top': 0.65; 'produce': 0.65; 'look': 0.65; 'improve': 0.66; 'earlier': 0.67; 'now,': 0.67; 'back': 0.67; 'outside': 0.67; 'header:Received:6': 0.67; 'time,': 0.67; 'received:64': 0.67; 'that,': 0.67; 'right': 0.68; 'items': 0.68; 'further': 0.69; 'functional': 0.69; 'repeatedly': 0.69; 'times': 0.69; 'above,': 0.70; 'process,': 0.75; '8bit%:100': 0.76; 'finds': 0.76; 'discuss': 0.78; 'returned': 0.81; 'ask,': 0.84; 'bid': 0.84; 'big,': 0.84; 'detail:': 0.84; 'easy.': 0.84; 'expand,': 0.84; 'inherent': 0.84; 'organised': 0.84; 'thus,': 0.84; "wikimedia's": 0.84; '\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0': 0.84; 'you?': 0.88; 'sub': 0.91; 'url:wikimedia': 0.91; 'word.': 0.91 X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1724900282; a=rsa-sha256; cv=none; b=Vqc7fDFI8TsgpwShoV128j95p+5Wy4EzoUb1LQ7ZZXTJKGCVGYtQ+SzVCKuWsx6dKkkRaJ EfRj7KSct7i1hvT7Pf2Hcb4YoNTcvOlCljWJVQqOIZ+Y7b8wptj5QwnSwpytNRFNvDzAgq SAKSp2tjlWYWde1AKOi923JZk5S465R45tKiAgRh2hb25Vwj3HqqV9Khu2SqnguaIR+OSb SIl56fIgZNP0vRmO9fd5ay2Yid+6UjMc+pHJQ67dGKqClv9/4diTMy//uBRvomA7XYNJiI J3z8fxJiBnsGmHKrxCYAW95FbsQa/LIRR3IPeHu/QkTPlIaRMQH6pnv7n26tIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1724900282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dpCse2wF+wG9jMdOvjYQymOdh4woKY4bmeSqP5PJ7fY=; b=tWkeapty85SNyV+PFl5SkwkWAcbAnrh0fuVzRConrx5kfSt37h7G4GeVBf3knX47mJDao6 OJKL413yCWYh8lNT2dglpd/WPlp1HS9CHslPSUJaavXS7VWWYV+JnIn4d8R4i7c6VtqKNY qYgxsGuqye+X2lYxhAzikWCCQfxSXtrRDy3Vg0x83Lp+sDRaNwunQf6sS7Vv6fACssJdtY BwbipZbenIEU3T92YuyqgV7EZFwuZp4MkrChxGwXkAkaaxvLlShYTCvh7gEcxRfzf7xvVc N6DFkPMMiw2Tnia+v1nOEjPNIKrIjbS1rEFNc8/TnCv3OmZFpAc7jBShMAI+UA== ARC-Authentication-Results: i=1; rspamd-cf944896d-txt8p; auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net X-MailChannels-Auth-Id: dreamhost X-Befitting-Spot: 29ad267c2d418b2c_1724900282752_922394888 X-MC-Loop-Signature: 1724900282752:1414773516 X-MC-Ingress-Time: 1724900282752 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net; s=dreamhost; t=1724900282; bh=dpCse2wF+wG9jMdOvjYQymOdh4woKY4bmeSqP5PJ7fY=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=kHKaRNIQ5d58qZEJlOaBgJOIY4Xj/eS8UgotXG+gGmjn36/kUrKSM65JgWOpt1SPy LEM7wFc+eC5X40n9utZHMAlEXO7Q6LVActJHR/7oSove05ZnNQ0nFvx+Mh2znboind L9Gv1kK1mTKzXyvt45Hts6AXywNmz3XwNGdskjDmV3gzGgs4RJ3nM1bqzluKz3H/2a POpciGhNksoFpVJlRU7cZMddoXdX/AcxBaSzmEtUJoVOZgQgvpgNXSATW+mWhQrz2D 2dv+dm7Vspl8tqYC6KpYT0QtcyjUooS0nmYNwZ/E3qNTNFeFHhQ12yCTEYBa95nWQ5 YM1RYXKR09mbA== User-Agent: Mozilla Thunderbird Content-Language: en-US In-Reply-To: <0fec5175-e2a2-407a-9e09-c6901617b75c@DancesWithMice.info> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: General discussion list for the Python programming language <python-list.python.org> List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> List-Archive: <https://mail.python.org/pipermail/python-list/> List-Post: <mailto:python-list@python.org> List-Help: <mailto:python-list-request@python.org?subject=help> List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> X-Mailman-Original-Message-ID: <0a5b67d8-ba6f-4a15-b9e6-a9905e5a987e@tompassin.net> X-Mailman-Original-References: <87r0a8xskb.fsf@rpi3> <bb82f035-45dc-4c6f-aaec-b1e59ce825f7@tompassin.net> <0fec5175-e2a2-407a-9e09-c6901617b75c@DancesWithMice.info> Bytes: 13856 On 8/28/2024 8:07 PM, dn via Python-list wrote: > On 29/08/24 10:32, Thomas Passin via Python-list wrote: >> On 8/28/2024 5:09 PM, Daniel via Python-list wrote: >>> As you all have seen on my intro post, I am in a project using Python >>> (which I'm learning as I go) using the wikimedia API to pull data from >>> wiktionary.org. I want to parse the json and output, for now, just the >>> definition of the word. >>> >>> Wiktionary is wikimedia's dictionary. >>> >>> My requirements for v1 >>> >>> Query the api for the definition for table (in the python script). >>> Pull the proper json >>> Parse the json >>> output the definition only > > >> You need to check at each part of the code to see if you are getting >> or producing what you think you are. You also should create a text >> constant containing the JSON input you expect to get. Make sure you >> can process that. Start simple - one main item. Then two main >> items. Then two main items with one sub item. And so on. >> >> I'm not sure what you want to produce in the end but this seems >> awfully complex to be starting with. Also you aren't taking advantage >> of the structure inherent in the JSON. If the data response isn't too >> big, you can probably take it as is and use the Python JSON reader to >> produce a Python data structure. It should be much easier (and >> faster) to process the data structure than to repeatedly scan all >> those lines of data with regexes. > > > Good effort so far! > > > Further to @Thomas: the code does seem to be taking the long way around! > How can we illustrate that, and improve life? > > > The Wiktionary docs at https://developer.wikimedia.org/use-content/ > discuss how to use their "Developer Portal". Worth reading! > > As part of the above, we find the "API:Data formats" page (https:// > www.mediawiki.org/wiki/API:Data_formats) which offers a simple example > (more simple than your objectives): > > api.php?action=query&titles=Main%20page&format=json > > which produces: > > { > "query": { > "pages": { > "217225": { > "pageid": 217225, > "ns": 0, > "title": "Main page" > } > } > } > } > > Does this look like a Python dict[ionary's] output to you? > > It is, (more discussion at the web.ref) > - but it is wrapped into a JSON payload. To give more detail: ========== REMAINDER OF ARTICLE TRUNCATED ==========