Re: python not working on RHEL6
Thomas Jollans wrote:
> On 02/10/2018 19:22, Dan Purgert wrote:
>> Thomas Jollans wrote:
>>> [...] (preferably, not in /usr - that's for OS-installed files only.
>>> /usr/local is a nice place to put things you installed from source).
>>
>> While I agree that /usr(/bin) is incorrect, I believe that "for
>> OS-installed files only" is taking it a bit far.
>>
>> My (admittedly, dim) recollection of the FHS is that the /usr hierarchy
>> is for static[1] "user" binaries, libraries, and so on; while being
>> OS-agnostic (so long as that OS followed the FHS).
>> [...]
>
> You're not wrong, but there's still a fairly strong convention that
> /usr/{bin,lib*,share,include} are only populated by (in some sense)
> non-essential components of the OS only, with varying definitions of
> "the OS". On Linux, this tends to mean "everything managed by the
> package manager", while on *BSD, it tends to exclude extra packages and
> ports collection.
>
> Whether we agree on the terminology here or not, of course we can agree
> that you have to be bloody careful if you *do* decide to put things in
> /usr/bin yourself :-)
I really have to get better at transferring thoughts to text. Maybe
some day I can write a tool for this :).
How's this for a take two:
While I agree that /usr(/bin) is incorrect, I believe that "for
OS-installed files _only_" is taking it a bit far.
Perhaps a better comment would've been "preferably not in /usr - it
is RECOMMENDED[1] to reserve that for OS-installed files"
(the bit where I referenced the FHS ...)
[1] See RFC2119
--
|_|O|_| Registered Linux user #585947
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281
--
https://mail.python.org/mailman/listinfo/python-list
Re: python not working on RHEL6
Chris Angelico wrote: > On Wed, Oct 3, 2018 at 5:17 AM Thomas Jollans wrote: >> [...] >> Whether we agree on the terminology here or not, of course we can agree >> that you have to be bloody careful if you *do* decide to put things in >> /usr/bin yourself :-) > > [...] On my system (Debian GNU/Linux), /usr/local/bin is ahead of > /usr/bin in $PATH, so even installing into local isn't going to > protect you. Here (MX 17), I'd also shoot myself in the foot if I installed something as "/usr/local/bin/python" :) $ echo $PATH /usr/local/bin:/usr/bin I imagine there's good reason for /usr/local/bin to override /usr/bin ... but it also seems like it's a good way to cause "fun(tm)" problems. -- |_|O|_| Registered Linux user #585947 |_|_|O| Github: https://github.com/dpurgert |O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281 -- https://mail.python.org/mailman/listinfo/python-list
Re: python not working on RHEL6
On Wed, Oct 3, 2018 at 9:11 PM Dan Purgert wrote: > > Chris Angelico wrote: > > On Wed, Oct 3, 2018 at 5:17 AM Thomas Jollans wrote: > >> [...] > >> Whether we agree on the terminology here or not, of course we can agree > >> that you have to be bloody careful if you *do* decide to put things in > >> /usr/bin yourself :-) > > > > [...] On my system (Debian GNU/Linux), /usr/local/bin is ahead of > > /usr/bin in $PATH, so even installing into local isn't going to > > protect you. > > Here (MX 17), I'd also shoot myself in the foot if I installed something > as "/usr/local/bin/python" :) > > $ echo $PATH > /usr/local/bin:/usr/bin > > I imagine there's good reason for /usr/local/bin to override /usr/bin > ... but it also seems like it's a good way to cause "fun(tm)" problems. > If a system script depends on Python, it should be calling on /usr/bin/python2.7 explicitly, rather than depending on $PATH. (And possibly using -E for further isolation.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: python not working on RHEL6
On 03/10/2018 13:17, Chris Angelico wrote: On Wed, Oct 3, 2018 at 9:11 PM Dan Purgert wrote: Chris Angelico wrote: On Wed, Oct 3, 2018 at 5:17 AM Thomas Jollans wrote: [...] Whether we agree on the terminology here or not, of course we can agree that you have to be bloody careful if you *do* decide to put things in /usr/bin yourself :-) [...] On my system (Debian GNU/Linux), /usr/local/bin is ahead of /usr/bin in $PATH, so even installing into local isn't going to protect you. Here (MX 17), I'd also shoot myself in the foot if I installed something as "/usr/local/bin/python" :) $ echo $PATH /usr/local/bin:/usr/bin I imagine there's good reason for /usr/local/bin to override /usr/bin ... but it also seems like it's a good way to cause "fun(tm)" problems. If a system script depends on Python, it should be calling on /usr/bin/python2.7 explicitly, rather than depending on $PATH. (And possibly using -E for further isolation.) (On Red Hat systems) they tend to call /usr/bin/python. -- https://mail.python.org/mailman/listinfo/python-list
asyncio await different coroutines on the same socket?
Using asyncio I am looking for a simple way to await multiple events where notification comes over the same socket (or other serial stream) in arbitrary order. For example, suppose I am communicating with a remote device that can run different commands simultaneously and I don't know which command will finish first. I want to do this: coro1 = start(command1) coro2 = start(command2) asyncio.gather(coro1, coro2) where either command may finish first. I’m hoping for a simple and idiomatic way to read the socket and tell each coroutine it is done. So far everything I have come up with is ugly, using multiple layers of "async def”, keeping a record of Tasks that are waiting and calling "set_result" on those Tasks when finished. Also Task isn’t even documented to have the set_result method (though "future" is) Is there a simple, idiomatic way to do this? -- Russell -- https://mail.python.org/mailman/listinfo/python-list
Re: Program to find Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
On Tuesday, October 2, 2018 at 5:01:43 PM UTC-5, Max Zettlmeißl wrote: > On Tue, Oct 2, 2018 at 10:23 PM, Musatov wrote: > > Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1. > > DATA > > > > 31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447, > > 3079, 3547, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439, > > 28729, 36683, 37831, 46853, 50411, 53129, 55457, 57367, 60251, 67339, > > 70489, 74797, 89669, 98909, 98911 > > > > EXAMPLE > > > > 7*5 - 3 - 1 = 31 > > > > 11*7 - 5 - 1 = 71 > > > > 11*7 - 5 + 1 = 73 > > > > 13*11 - 7 + 1 = 137 > > > > Can someone put this in a Python program and post? > > > > Here you go, my friend: > > #!/usr/bin/env python3 > > primes = """Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1. > DATA > > 31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447, 3079, > 35\ > 47, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439, 28729, 36683, > 3\ > 7831, 46853, 50411, 53129, 55457, 57367, 60251, 67339, 70489, 74797, 89669, > 989\ > 09, 98911 > > EXAMPLE > > 7*5 - 3 - 1 = 31 > > 11*7 - 5 - 1 = 71 > > 11*7 - 5 + 1 = 73 > > 13*11 - 7 + 1 = 137 """ > > if __name__ == "__main__": > print(primes) > > > As soon as you start showing more effort yourself in the form of your > honest attempts to create a program or at least in the form of some > serious ideas, you might get replies which better fit what you > attempted to receive. Hi Max, I think I see the code you made pretty much just outputs the data I already have. At least I learned something. Thanks, Martin -- https://mail.python.org/mailman/listinfo/python-list
Re: Program to find Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
On Tuesday, October 2, 2018 at 6:13:01 PM UTC-5, Rick Johnson wrote: > Musatov wrote: > > > I am drafting a sequence for OEIS. > > And, have you tried your hand at any Python code yet? Or any > tutorials? I am reading this: https://doc.lagout.org/programmation/python/Beginning%20Programming%20with%20Python%20for%20Dummies%20%5BMueller%202014-09-22%5D.pdf > > > I was told Python was most accessible for beginners. > > And you were told correctly! > > However, be warned that if you happen to become the next > victim of one of our overzealous hall monitors[1], there is > probably very little i can do to help you -- except, perhaps > -- to inform you that switching to the "comp.lang.python" > newsgroup (accessible from GoogleGroups or any Usenet > newsreader) will ensure that at least ~some~ of us will see > your messages. > > Since GvR has resigned, the community has been in something > of a turmoil. And for some reason -- thus far unbeknownst to > me, but soon to be unearth by brute force if necessary! -- > the moderators have gone bad-guano crazy and are purging > members who have been sacrificing blood, sweat and tears > for, oh... i dunno... *DECADES*!!! Thus, to say that i'm > both saddened and angered by the current state of affairs, > would be an understatement. > > At this point I'm not sure how ugly this battle may > become... > > But, i can tell you one thing with absolute certainty... > > The people who have invested their lives into this language > and this community, and for all of these many years, are not > about to stand idle as a few hijackers move-in and destroy > everything we've known, experienced and loved about this > community and this language. I saw it finally made #3! Congrats to the community. https://www.tiobe.com/tiobe-index// > > Yes, Guido is gone. And no, i cannot be sure if he will ever > return. But for those of us who _remain_, the fire of > passion still burns in each of our hearts for the little > language that we love so dearly -- AND I'LL BE *DAMNED*! -- > if some puny, little hall-monitor *PUNK*, is going to come > in here and destroy -- with snobbish flicks of his harry > potter wand! -- *ALL* of the blood, sweat and tears that > have been *SACRIFICED* on the alters of progress for a > idealist dream that this little peon wretch couldn't even > fathom! > > > @Ethan Furman: The window for civility is quickly closing. > You, and you _ALONE_, have the power to reverse this toxic > course and sail our ship back into calmer waters before we > have ourselves an outright *MUTINY*. I have called upon the > members of this community to voice their frustrations with > your Captain-Bligh-inspired leadership, and, as a result, > your name and reputation have suffered greatly. However, > there is still time, should you choose to harness it, to ask > for forgiveness and right these wrongs. But i must remind > you, that haste is of the essence. For the hour is late. > THE. HOUR. IS... *LATE*! > > > [1] And be particularly cautious around one who's name > sort-of-rhymes with: "Eatin' Turdcan". -- https://mail.python.org/mailman/listinfo/python-list
Re: Program to find Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
On Tuesday, October 2, 2018 at 3:49:14 PM UTC-5, Rick Johnson wrote: > Musatov wrote: > > > Well you don't know until you ask. > > Fair enough. > > So, uh, have you made any attempt to compose a Python program from this > assignment? > > If so, don't be shy... let's see it! I don't even know where to begin! (I'm reading the Dummies book) -- https://mail.python.org/mailman/listinfo/python-list
Re: Program to find Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
On Thu, Oct 4, 2018 at 1:31 AM Musatov wrote: > > On Tuesday, October 2, 2018 at 6:13:01 PM UTC-5, Rick Johnson wrote: > > Musatov wrote: > > > > > I am drafting a sequence for OEIS. > > > > And, have you tried your hand at any Python code yet? Or any > > tutorials? > I am reading this: > https://doc.lagout.org/programmation/python/Beginning%20Programming%20with%20Python%20for%20Dummies%20%5BMueller%202014-09-22%5D.pdf > > > > > I was told Python was most accessible for beginners. > > > > And you were told correctly! > > > > However, be warned that if you happen to become the next > > victim of one of our overzealous hall monitors[1], there is > > probably very little i can do to help you -- except, perhaps > > -- to inform you that switching to the "comp.lang.python" > > newsgroup (accessible from GoogleGroups or any Usenet > > newsreader) will ensure that at least ~some~ of us will see > > your messages. > > > > Since GvR has resigned, the community has been in something > > of a turmoil. And for some reason -- thus far unbeknownst to > > me, but soon to be unearth by brute force if necessary! -- > > the moderators have gone bad-guano crazy and are purging > > members who have been sacrificing blood, sweat and tears > > for, oh... i dunno... *DECADES*!!! Thus, to say that i'm > > both saddened and angered by the current state of affairs, > > would be an understatement. > > In case you haven't noticed, you're responding to one of the newsgroup's resident trolls. His posts have been completely blocked from the python-list mailing list for very good reason. I recommend ignoring him. Don't engage the trolls and eventually they might get bored of the sound of their own voices. (Not that I have very high hopes in his case. He could almost join Jim Hacker in parliament.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: asyncio await different coroutines on the same socket?
Hello Russell, On 03/10/2018 15:44, Russell Owen wrote: > Using asyncio I am looking for a simple way to await multiple events where > notification comes over the same socket (or other serial stream) in arbitrary > order. For example, suppose I am communicating with a remote device that can > run different commands simultaneously and I don't know which command will > finish first. I want to do this: > > coro1 = start(command1) > coro2 = start(command2) > asyncio.gather(coro1, coro2) > > where either command may finish first. I’m hoping for a simple and > idiomatic way to read the socket and tell each coroutine it is done. So far > everything I have come up with is ugly, using multiple layers of "async > def”, keeping a record of Tasks that are waiting and calling "set_result" > on those Tasks when finished. Also Task isn’t even documented to have the > set_result method (though "future" is) I don't really get what you want to achieve. Do you want to signal other coroutines that one of the others finished ? From what I understand, you want to have several coroutines reading on the same socket "simultaneously", and you want to stop all of them once one of them is finished. Am I getting it right ? -- Léo -- https://mail.python.org/mailman/listinfo/python-list
Re: asyncio await different coroutines on the same socket?
On Wed, Oct 3, 2018 at 7:47 AM Russell Owen wrote: > Using asyncio I am looking for a simple way to await multiple events where > notification comes over the same socket (or other serial stream) in arbitrary > order. For example, suppose I am communicating with a remote device that can > run different commands simultaneously and I don't know which command will > finish first. I want to do this: > > coro1 = start(command1) > coro2 = start(command2) > asyncio.gather(coro1, coro2) > > where either command may finish first. I’m hoping for a simple and > idiomatic way to read the socket and tell each coroutine it is done. So far > everything I have come up with is ugly, using multiple layers of "async > def”, keeping a record of Tasks that are waiting and calling "set_result" > on those Tasks when finished. Also Task isn’t even documented to have the > set_result method (though "future" is) Because Tasks are used to wrap coroutines, and the result of the Task should be determined by the coroutine, not externally. Instead of tracking tasks (that's what the event loop is for) I would suggest tracking futures instead. Have start(command1) return a future (or create a future that it will await on itself) that is not a task. Whenever a response from the socket is parsed, that code would then look up the corresponding future and call set_result on it. It might look something like this: class Client: async def open(self, host, port): self.reader, self.writer = await asyncio.open_connection(host, port) asyncio.create_task(self.read_loop()) async def read_loop(self): while not self.reader.at_eof(): response = self.reader.read() id = get_response_id(response) self._futures.pop(id).set_result(response) def start(self, command): future = asyncio.Future() self._futures[get_command_id(command)] = future self.writer.write(command) return future In this case start() is not a coroutine but its result is a future and can be awaited. -- https://mail.python.org/mailman/listinfo/python-list
Re: Program to find Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
On 10/03/2018 09:26 AM, Musatov wrote: > I don't even know where to begin! (I'm reading the Dummies book) If you have no experience in computer programming, it's going to be a steep learning curve. But your first step is to learn Python and how to write programs in it. That book and others will help with that. You'll have to write lots of simple programs unrelated to primes along the way that help you understand programming concepts. If you already have experience in other languages, the task will be easier. Computer programming is quite natural to some (small children seem to get it much easier than us adults), but I've seen others struggle to grasp the abstract concepts for years. Once you've grasped basic Python programming, you can return top the original problem at hand. Start by identifying the process or algorithm that would find these primes. In other words, how would you do it on pen and paper? Computer programs are not magic. They are only expressions of human thinking. Often some very smart mathematicians have come up with powerful algorithms (a step-by-step process) to do these things, and your job as a programmer is to turn this mathematical process into a computer program using things like loops and Boolean logic. How would you find these primes using your pen, paper, and calculator? -- https://mail.python.org/mailman/listinfo/python-list
Use Software Collections for RH - was Re: python not working on RHEL6
On 10/02/2018 07:59 AM, [email protected] wrote: > I guess from the little knowledge I have I should have executed > altinstall instead of install. Anyone know how to resolve this? Actually you probably should not have used a tarball at all. For some time now, Red Hat has offered more recent compilers and languages in RPM format that can install along side the system versions. This is far easier and far safer to work with on older operating systems. I assume you are using a redhat subscription for your RHEL6 install. Follow this: https://access.redhat.com/solutions/472793 If you don't have an active subscription, you might be able to use the CentOS version of software collections at: https://www.softwarecollections.org/en/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Use Software Collections for RH - was Re: python not working on RHEL6
On 10/03/2018 10:17 AM, Michael Torrie wrote: > On 10/02/2018 07:59 AM, [email protected] wrote: >> I guess from the little knowledge I have I should have executed >> altinstall instead of install. Anyone know how to resolve this? > > Actually you probably should not have used a tarball at all. For some > time now, Red Hat has offered more recent compilers and languages in RPM > format that can install along side the system versions. This is far > easier and far safer to work with on older operating systems. I assume > you are using a redhat subscription for your RHEL6 install. Follow this: > https://access.redhat.com/solutions/472793 > > If you don't have an active subscription, you might be able to use the > CentOS version of software collections at: > https://www.softwarecollections.org/en/ Sorry to reply to my own post, but here's a more specific page about Python 2.7 for either CentOS or RHEL: https://www.softwarecollections.org/en/scls/rhscl/python27/ See the bottom of the page for instructions on enabling the YUM repository for RHEL6. -- https://mail.python.org/mailman/listinfo/python-list
Re: Program to find Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
On Wednesday, October 3, 2018 at 11:12:43 AM UTC-5, Michael Torrie wrote: > On 10/03/2018 09:26 AM, Musatov wrote: > > I don't even know where to begin! (I'm reading the Dummies book) > > If you have no experience in computer programming, it's going to be a > steep learning curve. > > But your first step is to learn Python and how to write programs in it. > That book and others will help with that. You'll have to write lots of > simple programs unrelated to primes along the way that help you > understand programming concepts. > > If you already have experience in other languages, the task will be easier. > > Computer programming is quite natural to some (small children seem to > get it much easier than us adults), but I've seen others struggle to > grasp the abstract concepts for years. > > Once you've grasped basic Python programming, you can return top the > original problem at hand. Start by identifying the process or algorithm > that would find these primes. In other words, how would you do it on pen > and paper? Computer programs are not magic. They are only expressions > of human thinking. Often some very smart mathematicians have come up > with powerful algorithms (a step-by-step process) to do these things, > and your job as a programmer is to turn this mathematical process into a > computer program using things like loops and Boolean logic. How would > you find these primes using your pen, paper, and calculator? Literally, how I found them was taking a list of primes and checking if the calculations with the lesser primes resulted in numbers also further along on the list. Another way I guess would be to do the calculations then check if the number is prime. -- https://mail.python.org/mailman/listinfo/python-list
Help please installing Python on Windows 10
Hi, Could I please ask for help installing Python on Windows 10 - I've tried twice (Version 3.7 for windows) selecting the install now option. After first attempt I uninstalled and tried again. Each time it has put 4 items in the programs list from the windows start button, all under heading Python 3.7, but the first time they said 64 bit and the second time only 32 bit - I guess I must have clicked on different versions. Both times there was IDLE, Python 3.7, Manuals, and Module Docs. The last two of these worked when clicked on, but the first two just put up a small window of which first was white, and second was black, but I couldn't make them do anything. Could you please tell me what I'm doing wrong? Many thanks, Tim. -- https://mail.python.org/mailman/listinfo/python-list
Re: Replacing : with "${" at the beginning of the word and adding "}" at the end of the word
Yes it is. Thanks.
> A slightly better solution would be:
>
> cnv_sel = re.sub(r":(\w+)", r"${\1}", sel)
--
https://mail.python.org/mailman/listinfo/python-list
Re: Program to find Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
On Tuesday, October 2, 2018 at 5:54:30 PM UTC-5, Gary Herron wrote: > On 10/02/2018 01:23 PM, [email protected] wrote: > > Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1. > > DATA > > > > 31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447, > > 3079, 3547, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439, > > 28729, 36683, 37831, 46853, 50411, 53129, 55457, 57367, 60251, 67339, > > 70489, 74797, 89669, 98909, 98911 > > > > EXAMPLE > > > > 7*5 - 3 - 1 = 31 > > > > 11*7 - 5 - 1 = 71 > > > > 11*7 - 5 + 1 = 73 > > > > 13*11 - 7 + 1 = 137 > > > > Can someone put this in a Python program and post? > > > No, sorry, but that's not how this works. We're not here to do your > homework for you, and you won't learn anything if we do. You make an > attempt at solving this, asking any specific Python related questions > you need help with, and you'll find this to be prompt, friendly, and > helpful group. > > > Gary Herron > > > -- > Dr. Gary Herron > Professor of Computer Science > DigiPen Institute of Technology > (425) 895-4418 Thank you, Gary. I checked out your program at DigiPen, looks neat. -- https://mail.python.org/mailman/listinfo/python-list
Congratulations to the community!
https://www.tiobe.com/tiobe-index// Python #3 ranked language as of 09/2018 UP from #5 last year Musatov -- https://mail.python.org/mailman/listinfo/python-list
