« first day (729 days earlier)      last day (1670 days later) » 

7:19 PM
I don't know what's going on with that specific question. (I've not looked at any other posts by the user, if that's what you're referring to.) As far as that question and the weird comment about having uninstalled Python goes... They've edited the question but it's still not clear what they want or what they are doing. However, you can uninstall Python from Ubuntu. It's a bad idea, of course, except on a system you're using only for that to see if you can do it.
Removing Python uninstalls a lot of stuff, but the problem can usually be fixed without reinstalling, often fairly easily. It's still a bad idea and basically never achieves what anybody wants who attempts it. (I have attempted this several times (in virtual machines) to see what happens.)
The more valuable thing to know in more detail would be why people think they should remove Python at all. As far as I know, every system that anybody uses Python on, including Windows, can have multiple versions of Python on it and work fine.
 
On my main system which is running 18.04 155 packages will be removed if I try to uninstall python3.
 
Yeah.
That's usually the case.
I don't remember if, when I've tested removing python3, it has removed apparmor or not. I also don't remember if I've done it on 18.04, though I think I've done it on at least one later release. I'll have to try it again sometime soon.
 
@EliahKagan As far as I can tell Windows people are habitual of keeping of only 1 version and invoking that using a single word. Like they still want python to invoke Python 3.
 
On Windows, I have Python 2 and Python 3 installed. To invoke either interpreter, I use the py launcher (installed as C:\Windows\py.exe). For example:
C:\Users\ek> py -3 -V
Python 3.7.4
C:\Users\ek> py -2 -V
Python 2.7.16
You can have multiple versions of Python 2 or Python 3 installed and select between them by passing arguments like -3.whatever (where whatever is replaced with the rest of the version string) to py.
 
o_o Today I learned.
 
7:36 PM
There's also pyw for launching graphical tkinter apps when one doesn't want console host (i.e., a "terminal" window) shown. IMO the main reason to use the py launcher (or pyw) is really that, when you don't tell it what version you want, they conveniently read the first line of a script whose name is passed as an argument and, if it's a shebang, respect the shebang and start the correct interpreter (if you have it installed).
 
@EliahKagan That's cool.
 
@Kulfy That's one of the reasons I recommend people write #!/usr/bin/env python2 instead of #!/usr/bin/env python as the shebang for Python 2 scripts. Like in Arch Linux and, presumably, most other GNU/Linux systems at some point (perhaps far) in the future (though I think very few now), py and pyw on Windows take a shebang specifying python to mean Python 3 when there is a choice.
 
@EliahKagan That makes sense.
 
I talked about it (somewhat more clearly than I have here, I think) at the end of that answer.
 
I'm not sure how this would help.
 
7:54 PM
The OP's script is written in Python 3 but they inadvertently ran it as a Python 2 script in Ubuntu because they expected python in Ubuntu to be Python 3. The script used the built-in input function, which in Python 3 safely reads a line of input as a string. But in Python 2, the built-in input function behaves like eval(input()), reading a line of input and then evaluating it as code (which of course has some severe security implications as well as just not being what the OP wanted).
So only user input that was parseable and evaluable as Python code was accepted. The solution was to use the correct Python interpreter. Do you think I should slightly expand the answer to cover those specifics?
Or did you mean to link to something else? (I ask this because the link in your message is basically the same as the link in my immediately preceding message.)
 
Your answer is well explanatory.
Didn't realize I pasted the wrong link.
 
No problem! And actually, even though your point was unintentional, I actually think I should add a little bit to the end of the answer. Right now, people who don't know Python (or are only familiar with Python 3) would have to read the comments on the question to discern why my answer is actually answering the question. Also, input vs. raw_input is a particularly likely area where one should expect to see problems when a program for Python 3 is run as Python 2 code (or vice versa).
 
Indeed. Like Java, C++ still many users think that Python is backward compatible.
On a side note: This might be off-topic conversation. It would be great if you can migrate it to the island
 
Yes, I will do that shortly.
 
8:10 PM
:)
 
28 messages moved from Raiders of the Lost Downboat
For any interested readers: that message was a reply to this and that. That's where the conversation got more technical and off-topic for the Downboat, so I moved messages in the conversation starting there. I apologize for any confusion.
 

« first day (729 days earlier)      last day (1670 days later) »