Re: I wrote a free book about TDD and clean architecture in Python
Akkana, yes that is a good idea, even though I expected the LeanPub output to be already the correct one. I'll check with them. Thanks for reading the book, you actually gave me an idea: writing something about adding tests to a project *after* the code has been written. I already wrote a post on it, with a practical example, and this might be interesting. Many people discover TDD after they already wrote some code. Thanks On Thursday, 21 March 2019 01:15:40 UTC, Akkana Peck wrote: > > On 20/03/19 7:18 AM, Leonardo Giordani wrote: > > > Ha ha ha, yes I get it! =) I'm sorry, that depends entirely on the > > > LeanPub processing chain (I believe, I'll have a look just to be sure). I > > > hope the book will be useful even with this little issue. Thanks for > > > reading it! > > DL Neil writes: > > Yes, I'm happy reading from cover-to-cover. Unfortunately, not being able to > > refer back to (say) the Mocks chapter, means it will be of little utility > > (to me) in-future. > > For what it's worth, the epub version has chapter links that work > fine. So maybe you could download the epub version, and use calibre's > ebook-convert to make a mobi version? > > Nice book, Leonardo. I haven't finished part 2 yet, but part 1 > inspired me to go write some new tests for some of my existing programs, > and I'm planning to try test-first development for my next project. > > ...Akkana -- https://mail.python.org/mailman/listinfo/python-list
Re: I wrote a free book about TDD and clean architecture in Python
A couple of people asked the link to the post I mentioned, sorry I forgot to add it http://www.thedigitalcatonline.com/blog/2017/07/21/refactoring-with-test-in-python-a-practical-example/ This is just a very simple exercise in refactoring, but I believe it's a good starting point for people who never faced such a task. Enjoy! On Thursday, 21 March 2019 11:17:11 UTC, Leonardo Giordani wrote: > Akkana, yes that is a good idea, even though I expected the LeanPub output to > be already the correct one. I'll check with them. > > Thanks for reading the book, you actually gave me an idea: writing something > about adding tests to a project *after* the code has been written. I already > wrote a post on it, with a practical example, and this might be interesting. > Many people discover TDD after they already wrote some code. > > Thanks > > > On Thursday, 21 March 2019 01:15:40 UTC, Akkana Peck wrote: > > > On 20/03/19 7:18 AM, Leonardo Giordani wrote: > > > > Ha ha ha, yes I get it! =) I'm sorry, that depends entirely on the > > > > LeanPub processing chain (I believe, I'll have a look just to be sure). > > > > I hope the book will be useful even with this little issue. Thanks for > > > > reading it! > > > > DL Neil writes: > > > Yes, I'm happy reading from cover-to-cover. Unfortunately, not being able > > > to > > > refer back to (say) the Mocks chapter, means it will be of little utility > > > (to me) in-future. > > > > For what it's worth, the epub version has chapter links that work > > fine. So maybe you could download the epub version, and use calibre's > > ebook-convert to make a mobi version? > > > > Nice book, Leonardo. I haven't finished part 2 yet, but part 1 > > inspired me to go write some new tests for some of my existing programs, > > and I'm planning to try test-first development for my next project. > > > > ...Akkana -- https://mail.python.org/mailman/listinfo/python-list
What is the difference between "ws.Messagebeep(1)" and "ws.Messagebeep(-1)" ?
Also: What is the code for other tones that I can call? Footnote: When someone asks "A penny for your thoughts" and you give your 2c worth, I wonder what happens to that other penny? TTKMAWAN -- https://mail.python.org/mailman/listinfo/python-list
Timing problem?
I believe I can see what is happening here but maybe someone can explain least I run into this again. Situation 1: I am using "ws.MessageBeep(1)" to generate a tone through the speakers. I wanted two tones to separate it from other tones that might happen and placed that code a second time in the next line. Sometimes it would not beep, others just one beep. Situation 2" At the end of my program a report is generated and then it calls timer1.py to remind me when to enter the next readings from the lab. It looks as if the report generation is interrupted when timer1.py is called. If I place "time.sleep(1)" between the commands for the beep, I get two beeps one second apart reliably. If I place "time.sleep(5)" between the report generation the call for timer1.py is called then apparently there is enough time for the report to be generated. What is happening? Footnote: There's 99 bugs in the code, in the code. 99 bugs in the code. Take one down and patch it all around. Now there's 117 bugs in the code. -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the difference between "ws.Messagebeep(1)" and "ws.Messagebeep(-1)" ?
Assuming ws is winsound, MessageBeep(-1) produces a "simple beep". MessageBeep(1) doesn't seem to actually exist so it might fall back to that same "simple beep". The possible values are -1, MB_ICONASTERISK, MB_ICONEXCLAMATION, MB_ICONHAND, MB_ICONQUESTION, and MB_OK, all of which are defined in the winsound module. Alex On 2019-03-21 9:59 a.m., Steve wrote: > Also: What is the code for other tones that I can call? > > > > > > Footnote: > > When someone asks "A penny for your thoughts" and you give your 2c worth, > > I wonder what happens to that other penny? > > TTKMAWAN > > > -- https://mail.python.org/mailman/listinfo/python-list
RE: What is the difference between "ws.Messagebeep(1)" and "ws.Messagebeep(-1)" ?
I'm assuming by ws you mean winsound? Check the docs: https://docs.python.org/3.7/library/winsound.html winsound.MessageBeep(type=MB_OK) Call the underlying MessageBeep() function from the Platform API. This plays a sound as specified in the registry. The type argument specifies which sound to play; possible values are -1, MB_ICONASTERISK, MB_ICONEXCLAMATION, MB_ICONHAND, MB_ICONQUESTION, and MB_OK, all described below. The value -1 produces a “simple beep”; this is the final fallback if a sound cannot be played otherwise. If the system indicates an error, RuntimeError is raised. winsound.MB_ICONASTERISK Play the SystemDefault sound. winsound.MB_ICONEXCLAMATION Play the SystemExclamation sound. winsound.MB_ICONHAND Play the SystemHand sound. winsound.MB_ICONQUESTION Play the SystemQuestion sound. winsound.MB_OK Play the SystemDefault sound. -Original Message- From: Python-list [mailto:python-list-bounces+david.raymond=tomtom@python.org] On Behalf Of Steve Sent: Thursday, March 21, 2019 10:00 AM To: python-list@python.org Subject: What is the difference between "ws.Messagebeep(1)" and "ws.Messagebeep(-1)" ? Also: What is the code for other tones that I can call? Footnote: When someone asks "A penny for your thoughts" and you give your 2c worth, I wonder what happens to that other penny? TTKMAWAN -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Determining latest stable version for download
* Michael Torrie [190320 19:22]: > On 03/20/2019 07:10 PM, Tim Johnson wrote: > > * Ian Kelly [190320 12:00]: > >> 1) https://www.python.org/downloads/ has release information. Based on that > >> you would currently want 3.7.2. Make sure you actually download 3.7.2 and > >> not 3.7.2rc1. > > Understood. Thanks. Your info is the solution. > > I always found maintaining software installed from tarball on a remote > server was difficult at best. > > You mentioned it will be on CentOS. If you have CentOS 7, the EPEL > repository (nearly required by all installations in my opinion), has a > package for Python 3.6, called python36. The advantage there is that it > will be updated with point releases and kept somewhat secure by your > normal yum update process. > > Also you might check out RedHat's Software Collections at > https://www.softwarecollections.org/en/. They have Python 3.6 in it, > and I imagine 3.7 will be there soon. Software Collections might not > work for you as it installs to /opt and stays out of the default path. > It's more for developers who want to play with multiple versions of > languages and compilers. I'm currently on a shared server hosted by Hostmonster. I don't have root access, so a local install would be my only option. If local install doesn't work or is insufficient, then I would switch to a VPS. Since I'm retired and only a hobbyist in my Golden Years :), a shared server would be sufficient and cheaper, so that is my first choice. Having said that, if I have to go with a VPS (and root access) your information is very helpful. Thank you. -- Tim Johnson http://www.tj49.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Determining latest stable version for download
* Michael Torrie [190320 19:22]: > On 03/20/2019 07:10 PM, Tim Johnson wrote: > > * Ian Kelly [190320 12:00]: > >> 1) https://www.python.org/downloads/ has release information. Based on that > >> you would currently want 3.7.2. Make sure you actually download 3.7.2 and > >> not 3.7.2rc1. > > Understood. Thanks. Your info is the solution. > > I always found maintaining software installed from tarball on a remote > server was difficult at best. > > You mentioned it will be on CentOS. If you have CentOS 7, the EPEL > repository (nearly required by all installations in my opinion), has a > package for Python 3.6, called python36. The advantage there is that it > will be updated with point releases and kept somewhat secure by your > normal yum update process. > > Also you might check out RedHat's Software Collections at > https://www.softwarecollections.org/en/. They have Python 3.6 in it, > and I imagine 3.7 will be there soon. Software Collections might not > work for you as it installs to /opt and stays out of the default path. > It's more for developers who want to play with multiple versions of > languages and compilers. Michael, I should have asked the following question: Would I be able to install from the EPEL Repository or the Redhat Software Collections to a local ~/bin? thanks again -- Tim Johnson http://www.tj49.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Timing problem?
On Fri, Mar 22, 2019 at 1:01 AM Steve wrote: > > I believe I can see what is happening here but maybe someone can explain > least I run into this again. > > Situation 1: I am using "ws.MessageBeep(1)" to generate a tone through the > speakers. I wanted two tones to separate it from other tones that might > happen and placed that code a second time in the next line. Sometimes it > would not beep, others just one beep. > > Situation 2" At the end of my program a report is generated and then it calls > timer1.py to remind me when to enter the next readings from the lab. It > looks as if the report generation is interrupted when timer1.py is called. > > If I place "time.sleep(1)" between the commands for the beep, I get two beeps > one second apart reliably. > If I place "time.sleep(5)" between the report generation the call for > timer1.py is called then apparently there is enough time for the report to be > generated. > > What is happening? If I recall the context from previous discussion, "ws.MessageBeep(1)" creates the same tone that you would get if you had a message box pop up, right? In that case, Windows is probably suppressing duplicates - if there's a tone already playing, it won't play it again. This would be a good reason to switch back to using the PC speaker, as that would actually consume as much time as the beep does. An easy way to check this: >>> t = time.time(); ws.MessageBeep(1); print(time.time() - t) >>> t = time.time(); ws.Beep(262, 250); print(time.time() - t) My prediction is that the first one will take negligible time, but the second will pause for the quarter-second that the beep is taking. Additionally, this would let you play tones of different pitches, to separate them from other tones. Alternatively, if you don't want to use ws.Beep(), it might be best to switch to explicitly calling on VLC Media Player. Something like: >>> subprocess.check_call(["vlc", "--play-and-exit", "some-file.wav"]) which should play whatever audio tone you like. Freely usable sound bites can be obtained from various places on the internet, or you might have some yourself. (If you have "American McGee's Alice", the blunderbuss firing sound makes a great alarm tone. SssBOMss.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Might be doing this wrong? (Turtle graphics)
If you run on linux system? May be you are already installed for python 3, but not for python (python 2.7) or vice_versa . Checks this. (The code work fine, openSuSE Leap 15) El 20/03/19 a las 19:34, jasonanyil...@gmail.com escribió: So, I typed in code: from turtle import * forward(100) right(120) clear() It didn't work! It kept on saying that there was an indent and the first line was wrong. Help! -- Ing. Jesús Reyes Piedra Admin Red Neurodesarrollo,Cárdenas La caja decía:"Requiere windows 95 o superior"... Entonces instalé LINUX. -- Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas Infomed: http://www.sld.cu/ -- https://mail.python.org/mailman/listinfo/python-list
how to handle response data that is streaming and chunked?
Hello, I am trying to learn how to do use response library in the least confusing way possible. My data source is streaming. The sample I share below looks more complicated that it needs to be. I do not have enough experience with this to know better. Hence why I came here for guidance and direction. Comments are very welcome as well as pointers to reading material. I want to learn this. I expected that I was going to be able to use the JSON methods such as load or loads. After all, this is JSON and should be able to slurp into builtin python objects and data structures, I'd imagine. Does this mailing list use a paste site or is better to paste code in-line for future? Thanks for reading! --Art import os, sys, json, requests, signal from requests_oauthlib import OAuth1 api_key = 'HIDDEN' api_secret = 'HIDDEN' user_token_key = 'HIDDEN' user_token_secret = 'HIDDEN' authorization = OAuth1(api_key, api_secret, user_token_key, user_token_secret) session = requests.Session() session.auth = authorization finis = 0 def handler(signum, frame): global finis finis = 1 signal.signal(signal.SIGINT, handler) url = "https://stream.tradeking.com/v1/market/quotes.json?symbols=AAPL,DJT"; resp = session.get(url, stream=True) lines = '' for chunk in resp.iter_content(None, decode_unicode=True): if finis: break lines += chunk.decode('utf-8') while lines.find('}}') > 0: line, lines = lines.split('}}', 1) print(line) -- https://mail.python.org/mailman/listinfo/python-list
Re: how to handle response data that is streaming and chunked?
Some more info I wanted to add this relevant stack overflow post: https://stackoverflow.com/questions/17822342/understanding-python-http-streaming The code splitting on text produces the following sample output: {"status":"connected"}{"quote":{"ask":"195.95","asksz":"1000","bid":"195.93","bidsz":"1000","datetime":"2019-03-21T14:31:50-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193110" {"quote":{"ask":"195.95","asksz":"100","bid":"195.94","bidsz":"300","datetime":"2019-03-21T14:31:50-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193110" {"trade":{"cvol":"33872593","datetime":"2019-03-21T14:31:51-04:00","exch":{},"last":"195.9383","symbol":"AAPL","timestamp":"1553193111","vl":"100","vwap":"193.7212" {"quote":{"ask":"195.95","asksz":"900","bid":"195.93","bidsz":"1000","datetime":"2019-03-21T14:31:51-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193111" {"quote":{"ask":"195.95","asksz":"100","bid":"195.94","bidsz":"200","datetime":"2019-03-21T14:31:52-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193112" {"quote":{"ask":"195.95","asksz":"100","bid":"195.93","bidsz":"1000","datetime":"2019-03-21T14:31:53-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193113" {"trade":{"cvol":"33880369","datetime":"2019-03-21T14:31:53-04:00","exch":{},"last":"195.9449","symbol":"AAPL","timestamp":"1553193113","vl":"130","vwap":"193.7217" {"quote":{"ask":"195.95","asksz":"100","bid":"195.93","bidsz":"1000","datetime":"2019-03-21T14:31:53-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193113" {"trade":{"cvol":"33886479","datetime":"2019-03-21T14:31:54-04:00","exch":{},"last":"195.94","symbol":"AAPL","timestamp":"1553193114","vl":"100","vwap":"193.7221" {"trade":{"cvol":"33886650","datetime":"2019-03-21T14:31:55-04:00","exch":{},"last":"195.95","symbol":"AAPL","timestamp":"1553193115","vl":"20","vwap":"193.7221" {"trade":{"cvol":"33886779","datetime":"2019-03-21T14:31:55-04:00","exch":{},"last":"195.95","symbol":"AAPL","timestamp":"1553193115","vl":"100","vwap":"193.7221" {"trade":{"cvol":"33888294","datetime":"2019-03-21T14:31:56-04:00","exch":{},"last":"195.9489","symbol":"AAPL","timestamp":"1553193116","vl":"1464","vwap":"193.7222" {"quote":{"ask":"195.97","asksz":"200","bid":"195.95","bidsz":"300","datetime":"2019-03-21T14:31:56-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193116" This seems like a tedious way to move to forward. That is why I am trying to understand what my options are for chunked data and hopefully running the response data through a JSON decoder ring. I want well-known data structure objects. I believe it to be possible. I just do not know how to get there from here. Everybody may agree that doing it this way, and further, extracting this data from text with regex is the cornerstone of a poor implementation. My current journey is to learn a better way. :-) Thank you -- https://mail.python.org/mailman/listinfo/python-list
Re: how to handle response data that is streaming and chunked?
On 2019-03-21, Artie Ziff wrote: > I am trying to learn how to do use response library in the least > confusing way possible. > > [...] What do you mean by "response library"? > Does this mailing list use a paste site or is better to paste code > in-line for future? You can do either, but not everbody is willing to click on links, so you're limiting your audience if you don't actually include the source code you're asking about in your post. -- Grant Edwards grant.b.edwardsYow! Am I in GRADUATE at SCHOOL yet? gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: how to handle response data that is streaming and chunked?
On 2019-03-21 20:12, Artie Ziff wrote: Hello, I am trying to learn how to do use response library in the least confusing way possible. My data source is streaming. The sample I share below looks more complicated that it needs to be. I do not have enough experience with this to know better. Hence why I came here for guidance and direction. Comments are very welcome as well as pointers to reading material. I want to learn this. I expected that I was going to be able to use the JSON methods such as load or loads. After all, this is JSON and should be able to slurp into builtin python objects and data structures, I'd imagine. Does this mailing list use a paste site or is better to paste code in-line for future? Thanks for reading! --Art import os, sys, json, requests, signal from requests_oauthlib import OAuth1 api_key = 'HIDDEN' api_secret = 'HIDDEN' user_token_key = 'HIDDEN' user_token_secret = 'HIDDEN' authorization = OAuth1(api_key, api_secret, user_token_key, user_token_secret) session = requests.Session() session.auth = authorization finis = 0 def handler(signum, frame): global finis finis = 1 signal.signal(signal.SIGINT, handler) url = "https://stream.tradeking.com/v1/market/quotes.json?symbols=AAPL,DJT"; resp = session.get(url, stream=True) lines = '' for chunk in resp.iter_content(None, decode_unicode=True): if finis: break lines += chunk.decode('utf-8') while lines.find('}}') > 0: line, lines = lines.split('}}', 1) print(line) As far I can tell from the docs, calling '.iter_content' with 'decode_unicode=True' will make it decode, so you shouldn't be decoding it again. Also, string indexes start at 0, and '.find' will return -1 if the string is not found. As you don't need the index itself, you might as well use 'in' instead: while '}}' in lines: On the other hand, you're splitting the string, so maybe it would be better to use '.partition': before, sep, after = lines.partition('}}'): while sep: print(before + sep) lines = after before, sep, after = lines.partition('}}'): Note that when you split or partition on '}}', you'll lose the '}}' itself if you're not careful, hence the 'before + sep' above. -- https://mail.python.org/mailman/listinfo/python-list
Re: how to handle response data that is streaming and chunked?
On 2019-03-21 21:09, Artie Ziff wrote: Some more info I wanted to add this relevant stack overflow post: https://stackoverflow.com/questions/17822342/understanding-python-http-streaming The code splitting on text produces the following sample output: {"status":"connected"}{"quote":{"ask":"195.95","asksz":"1000","bid":"195.93","bidsz":"1000","datetime":"2019-03-21T14:31:50-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193110" {"quote":{"ask":"195.95","asksz":"100","bid":"195.94","bidsz":"300","datetime":"2019-03-21T14:31:50-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193110" {"trade":{"cvol":"33872593","datetime":"2019-03-21T14:31:51-04:00","exch":{},"last":"195.9383","symbol":"AAPL","timestamp":"1553193111","vl":"100","vwap":"193.7212" {"quote":{"ask":"195.95","asksz":"900","bid":"195.93","bidsz":"1000","datetime":"2019-03-21T14:31:51-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193111" {"quote":{"ask":"195.95","asksz":"100","bid":"195.94","bidsz":"200","datetime":"2019-03-21T14:31:52-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193112" {"quote":{"ask":"195.95","asksz":"100","bid":"195.93","bidsz":"1000","datetime":"2019-03-21T14:31:53-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193113" {"trade":{"cvol":"33880369","datetime":"2019-03-21T14:31:53-04:00","exch":{},"last":"195.9449","symbol":"AAPL","timestamp":"1553193113","vl":"130","vwap":"193.7217" {"quote":{"ask":"195.95","asksz":"100","bid":"195.93","bidsz":"1000","datetime":"2019-03-21T14:31:53-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193113" {"trade":{"cvol":"33886479","datetime":"2019-03-21T14:31:54-04:00","exch":{},"last":"195.94","symbol":"AAPL","timestamp":"1553193114","vl":"100","vwap":"193.7221" {"trade":{"cvol":"33886650","datetime":"2019-03-21T14:31:55-04:00","exch":{},"last":"195.95","symbol":"AAPL","timestamp":"1553193115","vl":"20","vwap":"193.7221" {"trade":{"cvol":"33886779","datetime":"2019-03-21T14:31:55-04:00","exch":{},"last":"195.95","symbol":"AAPL","timestamp":"1553193115","vl":"100","vwap":"193.7221" {"trade":{"cvol":"33888294","datetime":"2019-03-21T14:31:56-04:00","exch":{},"last":"195.9489","symbol":"AAPL","timestamp":"1553193116","vl":"1464","vwap":"193.7222" {"quote":{"ask":"195.97","asksz":"200","bid":"195.95","bidsz":"300","datetime":"2019-03-21T14:31:56-04:00","exch":{},"qcond":"REGULAR","symbol":"AAPL","timestamp":"1553193116" This seems like a tedious way to move to forward. That is why I am trying to understand what my options are for chunked data and hopefully running the response data through a JSON decoder ring. I want well-known data structure objects. I believe it to be possible. I just do not know how to get there from here. Everybody may agree that doing it this way, and further, extracting this data from text with regex is the cornerstone of a poor implementation. My current journey is to learn a better way. :-) I see that you lost the final '}}'! OK, try splitting on '}', decode the JSON, and if that fails (because of nested dicts), split on the next '}', etc, until it decodes successfully: # Start at the beginning. pos = 0 while True: pos = lines.find('}', pos) if pos < 0: # No (more) '}'. break # Keep the '}'. pos += 1 try: # Try decoding it. line = json.loads(lines[ : pos]) except ValueError: # Probably truncated; try again. pass else: # Success! print(line) # The remainder. lines = lines[pos : ] # Reset. pos = 0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Determining latest stable version for download
On 03/21/2019 09:36 AM, Tim Johnson wrote: > Michael, I should have asked the following question: > Would I be able to install from the EPEL Repository or the Redhat > Software Collections to a local ~/bin? I am not sure, but have my doubts. Software Collections distributes software in RPM, with pathes hardcoded to /opt/rh/. You may be able to use "alien" to convert the RPM to a tarball that you could untar somewhere in your home directory. The scripts to "enable" a software collections module into your current path would work regardless of install point. Maybe this is faster than compiling from source? I'm not sure. -- https://mail.python.org/mailman/listinfo/python-list
Re: Determining latest stable version for download
On Fri, Mar 22, 2019 at 11:56 AM Michael Torrie wrote: > > On 03/21/2019 09:36 AM, Tim Johnson wrote: > > Michael, I should have asked the following question: > > Would I be able to install from the EPEL Repository or the Redhat > > Software Collections to a local ~/bin? > > I am not sure, but have my doubts. Software Collections distributes > software in RPM, with pathes hardcoded to /opt/rh/. > > You may be able to use "alien" to convert the RPM to a tarball that you > could untar somewhere in your home directory. The scripts to "enable" a > software collections module into your current path would work regardless > of install point. Maybe this is faster than compiling from source? I'm > not sure. I don't know about RPMs, but it'll most likely be equivalent to what I've done with Debian packages. Advantages include not needing to install the dev libraries for everything, not needing to worry about optimization settings on the compilation (ideally, the upstream packager will use PGO), and some verification that it should work with your libraries. Disadvantages include that there may be paths hard-coded into it (if you build from source, you can tell it to put it in ~/bin), and having to learn how to extract your platform's packages. Often worth it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
log file
I am running a program and even though the program runs all fine, the log file is missing. I have pasted first few lines of the code. Any suggestions where I maybe going wrong? import os import csv import logging import assertion_design as asd import random #Create and configure logger logging.basicConfig(filename="test_1.log", filemode='w', format='%(asctime)s %(message)s') import os import csv import logging import assertion_design as asd import random #Create and configure logger logging.basicConfig(filename="test_1.log", filemode='w', format='%(asctime)s %(message)s') -- https://mail.python.org/mailman/listinfo/python-list
Re: REPL, global, and local scoping
On Tuesday, March 19, 2019 at 9:49:48 PM UTC-5, Chris Angelico wrote: > I would recommend parsing in two broad steps, as CPython does: > > 1) Take the source code and turn it into an abstract syntax tree > (AST). This conceptualizes the behaviour of the code more-or-less the > way the programmer wrote it. > > 2) Implement the AST in byte-code. You are totally right. It's not getting me here, but I am running into a problem using ANTLR's visitors to deal with what kind of storage opcode to use when running into an assignment. I only roughly pondered it in my head but never really looked at the AST Python was generating for clues. But, you see, my cat is hungry and I have to, you know, ... take care of him. A lot. For awhile. Yeah. ;) -- https://mail.python.org/mailman/listinfo/python-list
Re: log file
On 22/03/19 4:25 PM, Sharan Basappa wrote: I am running a program and even though the program runs all fine, the log file is missing. I have pasted first few lines of the code. Any suggestions where I maybe going wrong? import os import csv import logging import assertion_design as asd import random #Create and configure logger logging.basicConfig(filename="test_1.log", filemode='w', format='%(asctime)s %(message)s') import os import csv import logging import assertion_design as asd import random #Create and configure logger logging.basicConfig(filename="test_1.log", filemode='w', format='%(asctime)s %(message)s') Do all of these lines actually appear, or is it an accidental copy-paste+paste? What do you use to actually record data in the log? eg logging.info("Informational message") Any error message from Python? When you say "the log file is missing" do you mean that there is no such file, that there is an empty file, or what? Which directory do you run the code from, and in which directory do you expect to find the log file? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: log file
On Thursday, March 21, 2019 at 10:26:14 PM UTC-5, Sharan Basappa wrote: > I am running a program and even though the program runs all fine, the log > file is missing. I have pasted first few lines of the code. > I am thinking--hoping, rather--that you just kind of double pasted there. Anyways, you needed to specify the logging level in basicConfig: import os import csv import logging import random #Create and configure logger # Check out level=logging.INFO logging.basicConfig(filename="test_1.log", filemode='w', format='%(asctime)s %(message)s', level=logging.INFO) log = logging.getLogger() log.info("Yay!") -- https://mail.python.org/mailman/listinfo/python-list
Re: log file
On 2019-03-22 03:25, Sharan Basappa wrote: I am running a program and even though the program runs all fine, the log file is missing. I have pasted first few lines of the code. Any suggestions where I maybe going wrong? import os import csv import logging import assertion_design as asd import random #Create and configure logger logging.basicConfig(filename="test_1.log", filemode='w', format='%(asctime)s %(message)s') import os import csv import logging import assertion_design as asd import random #Create and configure logger logging.basicConfig(filename="test_1.log", filemode='w', format='%(asctime)s %(message)s') Are you sure that you know where it's putting the log file? You have a relative path there, but relative to where? Try it with an absolute path. Are you sure that it's logging anything? Log a simple message just after configuring to double-check. -- https://mail.python.org/mailman/listinfo/python-list