ttk.Notebook Tabs Question

2017-09-11 Thread Wildman via Python-list
I am working on a program that has a ttk.Notebook with 12 tabs. Is there a way to determine the total width of the tabs in pixels. Just to be clear I am not talking about width of the nb container. I am talking about tabs themselves that contain the text. I want the program to be resizable but

Re: ttk.Notebook Tabs Question

2017-09-15 Thread Wildman via Python-list
On Fri, 15 Sep 2017 06:09:21 +0400, Abdur-Rahmaan Janhangeer wrote: > try > widget["width"] it returns string > then mult by no. of tabs Since the tabs are displaying text, I believe the width would be returned as characters or letters like a Button or Text widget. I need pixels. Another proble

Re: ttk.Notebook Tabs Question

2017-09-15 Thread Wildman via Python-list
On Fri, 15 Sep 2017 20:45:20 +0100, MRAB wrote: > On 2017-09-15 16:24, Wildman via Python-list wrote: >> On Fri, 15 Sep 2017 06:09:21 +0400, Abdur-Rahmaan Janhangeer wrote: >> >>> try >>> widget["width"] it returns string >>> then mult by no.

Re: ttk.Notebook Tabs Question

2017-09-17 Thread Wildman via Python-list
On Sun, 17 Sep 2017 08:45:27 +0400, Abdur-Rahmaan Janhangeer wrote: > by widget["width"] i meant replace widget with your widget Yes, that is what I did. It returned 0. -- GNU/Linux user #557453 The cow died so I don't need your bull! -- https://mail.python.org/mailman/listinfo/python-list

Re: error from Popen only when run from cron

2018-01-27 Thread Wildman via Python-list
On Sat, 27 Jan 2018 10:58:36 -0500, Larry Martell wrote: > I have a script that does this: > > subprocess.Popen(['service', 'some_service', 'status'], > stdout=subprocess.PIPE, stderr=subprocess.STDOUT) > > When I run it from the command line it works fine. When I run it from > cron I get: > >

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Wildman via Python-list
On Sun, 28 Jan 2018 15:04:26 +, Steven D'Aprano wrote: > I'm seeing this annoying practice more and more often. Even for trivial > pieces of text, a few lines, people post screenshots instead of copying > the code. > > Where has this meme come from? It seems to be one which inconveniences

Python 2 to 3 Conversion

2018-02-16 Thread Wildman via Python-list
I have a bit of code I found on the web that will return the ip address of the named network interface. The code is for Python 2 and it runs fine. But, I want to use the code with Python 3. Below is the code followed by the error message. Suggestions appreciated. #!/usr/bin/env python3 import

Re: Python 2 to 3 Conversion

2018-02-18 Thread Wildman via Python-list
Thanks to Chris and Ben. Your suggestions were slightly different but both worked equally well, although I don't understand how that can be so. > struct.pack('256s', ifname[:15].encode('ascii')) > struct.pack('256s', ifname.encode('ascii')) I was looking for a reliable way to determine the IP ad

Re: Python 2 to 3 Conversion

2018-02-18 Thread Wildman via Python-list
On Sun, 18 Feb 2018 20:51:18 +1100, Chris Angelico wrote: > On Sun, Feb 18, 2018 at 4:35 AM, Wildman via Python-list > wrote: >> Thanks to Chris and Ben. Your suggestions were slightly >> different but both worked equally well, although I don't >>

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Mon, 19 Feb 2018 12:32:49 +, Rhodri James wrote: > On 18/02/18 16:18, Wildman via Python-list wrote: >>> But that's only going to show one (uplink) address. If I needed to get >>> ALL addresses for ALL network adapters, I'd either look for a library, >>

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Tue, 20 Feb 2018 02:26:19 +1100, Chris Angelico wrote: > * Opaque IOCTLs Would you mind to elaborate a little about your concerns? -- GNU/Linux user #557453 "There are only 10 types of people in the world... those who understand Binary... and those who don't." -Spike -- https://mail.pyth

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Tue, 20 Feb 2018 05:39:15 +1100, Chris Angelico wrote: > On Tue, Feb 20, 2018 at 3:53 AM, Wildman via Python-list > wrote: >> On Tue, 20 Feb 2018 02:26:19 +1100, Chris Angelico wrote: >> >>> * Opaque IOCTLs >> >> Would you mind to elaborate a little ab

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Tue, 20 Feb 2018 05:31:27 +1100, Chris Angelico wrote: > On Tue, Feb 20, 2018 at 3:49 AM, Wildman via Python-list > wrote: >> On Mon, 19 Feb 2018 12:32:49 +, Rhodri James wrote: >> >>> On 18/02/18 16:18, Wildman via Python-list wrote: >>>>>

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Tue, 20 Feb 2018 10:55:28 +1100, Chris Angelico wrote: > The given homepage URL is > http://alastairs-place.net/projects/netifaces/ - is that the right > one? > > ChrisA Yes, that is the right one. Now I'm feeling a little stupid. I should have remembered that many python library package nam

Re: How to only get \n for newline without the single quotes?

2018-02-24 Thread Wildman via Python-list
On Sat, 24 Feb 2018 11:41:32 -0600, Peng Yu wrote: > I would like to just get the escaped string without the single quotes. > Is there a way to do so? Thanks. > x='\n' print repr(x) > '\n' Python 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118] on linux Type "help", "copyri

Re: psutil

2018-02-27 Thread Wildman via Python-list
On Tue, 27 Feb 2018 19:29:50 -0500, Larry Martell wrote: > Trying to install psutil (with pip install psutil) on Red Hat EL 7. > It's failing with: > > Python.h: No such file or directory > > Typically that means the python devel libs are not installed, but they are: > > [root@liszt ~]# yum ins

Re: Problem: Need galileo running on debian wheezy

2018-03-01 Thread Wildman via Python-list
On Thu, 01 Mar 2018 13:44:27 -0500, Gene Heskett wrote: > I know its supposed to be in the debian stretch repo's. > > I've been told to get a fitbit, but they don't support linux of any > flavor, and that leaves galileo as the possible solution? > > So how should I proceed since the only stretc

Re: Does This Scare You?

2016-08-19 Thread Wildman via Python-list
On Sat, 20 Aug 2016 10:57:37 +1000, Chris Angelico wrote: > On Sat, Aug 20, 2016 at 9:42 AM, Lawrence D’Oliveiro > wrote: >> Python 3.5.2+ (default, Aug 5 2016, 08:07:14) >> [GCC 6.1.1 20160724] on linux >> Type "help", "copyright", "credits" or "license" for more information. >>

Re: Does This Scare You?

2016-08-19 Thread Wildman via Python-list
On Sat, 20 Aug 2016 11:20:44 +1000, Chris Angelico wrote: > On Sat, Aug 20, 2016 at 11:11 AM, Wildman via Python-list > wrote: >> Since I am fairly new to Python, I realize there is much that I >> still don't know but I don't understand how Windows can have >>

Re: Does This Scare You?

2016-08-22 Thread Wildman via Python-list
On Mon, 22 Aug 2016 17:27:13 +, Jon Ribbens wrote: > On 2016-08-22, Chris Angelico wrote: >> I tried things like "con.txt" and it simply failed (no such file or >> directory), without printing anything to the console. > > I'm not sure how you got that to fail, but writing to "con.txt" > cert

Re: saving octet-stream png file

2016-08-22 Thread Wildman via Python-list
On Mon, 22 Aug 2016 13:21:43 -0400, Larry Martell wrote: > On Fri, Aug 19, 2016 at 4:51 PM, Lawrence D’Oliveiro > wrote: >> On Saturday, August 20, 2016 at 6:03:53 AM UTC+12, Terry Reedy wrote: >>> >>> An 'octet' is a byte of 8 bits. >> >> Is there any other size of byte? > > Many, many years ag

Re: Installing python

2016-09-05 Thread Wildman via Python-list
On Mon, 05 Sep 2016 20:01:08 +, alister wrote: > On Mon, 05 Sep 2016 12:46:58 -0700, emaraiza98 wrote: > >> I installed pycharm for a computer science class I'm taking, and also >> downloaded python 3.5.2. However, my computer for some reason won't use >> 3.5.2 and my professor told me I need

Re: Python 3 curiosity.

2016-09-06 Thread Wildman via Python-list
On Tue, 06 Sep 2016 02:51:39 -0700, wxjmfauth wrote: > It's curious to see all these apps, that were > more of less working correctly up to Python 3.2 > (included) and are now no more working at all. > > Probably something wrong somewhere... http://sebastianraschka.com/Articles/2014_python_2_3_k

Re: Python 3 curiosity.

2016-09-06 Thread Wildman via Python-list
On Wed, 07 Sep 2016 02:27:40 +1000, Chris Angelico wrote: > On Wed, Sep 7, 2016 at 2:13 AM, Wildman via Python-list > wrote: >> On Tue, 06 Sep 2016 02:51:39 -0700, wxjmfauth wrote: >> >>> It's curious to see all these apps, that were >>> more o

Re: Why does the insert after list function fail?

2016-09-22 Thread Wildman via Python-list
On Thu, 22 Sep 2016 12:29:12 -0700, 380162267qq wrote: > A=["1","2","3"] > print(list(map(float,A)).insert(0,1)) > > I want to insert 1 at the head of the list but this gives me a surprise I am not certain about what you are doing so I might be way off here. The following will insert 1 at the he

Re: How to reduce the DRY violation in this code

2016-09-27 Thread Wildman via Python-list
On Tue, 27 Sep 2016 10:30:05 -0700, Paul Rubin wrote: > Chris Angelico writes: >> Can you elaborate on what "GoF builder" means? Presumably it's a >> special case of the builder pattern, > > I think it just means the usual builder pattern, from the Design > Patterns book by the so-called Gang o

Re: Scripting Help please

2016-10-12 Thread Wildman via Python-list
On Wed, 12 Oct 2016 20:48:31 +, alister wrote: > On Wed, 12 Oct 2016 13:37:23 -0700, LongHairLuke wrote: > >> Hi l am on my way to make a bot for the game Piano Tiles 2. >> But the code l have written so far saids invalid syntax at 2nd line. >> Here is my code: >> >> >> >> while True: >>

Re: [FAQ] "Best" GUI toolkit for python

2016-10-17 Thread Wildman via Python-list
On Tue, 18 Oct 2016 00:58:42 +0200, pozz wrote: > I'm sorry, I know it is a FAQ..., but I couldn't find a good answer. > > I'm learning python and I'd like to start creating GUI applications, > mainly for Windows OS. In the past, I wrote many applications in Visual > Basic 4: it was very fast a

Button Widget and Key Binding Problem

2016-10-18 Thread Wildman via Python-list
I am working on a program with a GUI created with Tkinter. I want to enable key bindings for the button widgets. Below is some of the code to show how the window and button widget was created. The button calls a routine that will load an image. class Window(tk.Frame): def __init__(self, m

Re: Button Widget and Key Binding Problem

2016-10-19 Thread Wildman via Python-list
On Wed, 19 Oct 2016 04:39:03 +0100, MRAB wrote: > The 'bind' method passes an 'event' object when it calls; the 'command' > callback doesn't. > > You don't care about the 'event' object anyway, so you can just define a > single method with a default argument that you ignore: > > def load_

Re: How to handle errors?

2016-10-20 Thread Wildman via Python-list
On Thu, 20 Oct 2016 12:48:28 -0700, SS wrote: > The following script works fine: > > #!/bin/python > > import socket > > str = raw_input("Enter a domain name: "); > print "Your domain is ", str > print socket.gethostbyname(str) > > You provide it a hostname, it provides an IP. That works fine

Re: How to handle errors?

2016-10-20 Thread Wildman via Python-list
On Thu, 20 Oct 2016 12:48:28 -0700, SS wrote: > The following script works fine: > > #!/bin/python I meant to include this with my other post but I forgot it. Using a direct path to the Python interpreter can cause problems on some systems because it is not always installed to the same director

Re: How to handle errors?

2016-10-21 Thread Wildman via Python-list
On Fri, 21 Oct 2016 16:14:41 +1100, Steve D'Aprano wrote: > On Fri, 21 Oct 2016 11:03 am, Wildman wrote: > >> On Thu, 20 Oct 2016 12:48:28 -0700, SS wrote: >> >>> The following script works fine: >>> >>> #!/bin/python >> >> I meant to include this with my other post but I forgot it. >> >> Usi

Re: How to handle errors?

2016-10-22 Thread Wildman via Python-list
On Sat, 22 Oct 2016 15:01:46 +, John Gordon wrote: > In Wildman > writes: > >> > Another serious problem with using env in the hash-bang line is that you >> > cannot pass commandline options to the Python executable. > >> Not true. I made a test script with this code: > >> #!/usr/bin/en

Re: exist loop by pressing esc

2016-10-23 Thread Wildman via Python-list
On Sun, 23 Oct 2016 14:34:29 -0700, chris alindi wrote: > simple while loop range(10) if user press esc exits loop If I understand you correctly you want to exit a while loop with the ESC key. That can be done but it depends on the platform. For Windows use this: (not tested) import msvcrt wh

Re: How to execute "gksudo umount VirtualDVD"

2016-10-28 Thread Wildman via Python-list
On Fri, 28 Oct 2016 11:05:17 +0300, Demosthenes Koptsis wrote: > Yes it was pasted wrong... > > def umount(self): > '''unmounts VirtualDVD''' > cmd = 'gksudo umount VirtualDVD' > proc = subprocess.Popen(str(cmd), shell=True, > stdout=subprocess.PIPE).stdout.read()

Re: How to execute "gksudo umount VirtualDVD"

2016-10-28 Thread Wildman via Python-list
On Fri, 28 Oct 2016 17:19:17 -0500, Wildman wrote: > On Fri, 28 Oct 2016 11:05:17 +0300, Demosthenes Koptsis wrote: > >> Yes it was pasted wrong... >> >> def umount(self): >> '''unmounts VirtualDVD''' >> cmd = 'gksudo umount VirtualDVD' >> proc = subprocess.Popen(

Calling Bash Command From Python

2016-10-30 Thread Wildman via Python-list
Python 2.7.9 on Linux Here is a bash command that I want to run from a python program: sudo grep "^user\:" /etc/shadow If I enter the command directly into a terminal it works perfectly. If I run it from a python program it returns an empty string. Below is the code I am using. Suggestions ap

Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 15:31:27 +1100, Chris Angelico wrote: > On Mon, Oct 31, 2016 at 3:19 PM, Wildman via Python-list > wrote: >> Here is a bash command that I want to run from a python >> program: sudo grep "^user\:" /etc/shadow >> >> If I enter the c

Re: Call a shell command from Python (was: Calling Bash Command From Python)

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 15:44:13 +1100, Ben Finney wrote: > Wildman via Python-list writes: > >> Python 2.7.9 on Linux >> >> Here is a bash command that I want to run from a python >> program: sudo grep "^user\:" /etc/shadow > > Some points to note:

Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 09:12:57 +0100, Peter Otten wrote: > Wildman via Python-list wrote: > >> Python 2.7.9 on Linux >> >> Here is a bash command that I want to run from a python >> program: sudo grep "^user\:" /etc/shadow >> >> If I

Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 08:13:54 +, Jon Ribbens wrote: > On 2016-10-31, Wildman wrote: >> Here is a bash command that I want to run from a python >> program: sudo grep "^user\:" /etc/shadow >> >> If I enter the command directly into a terminal it works >> perfectly. If I run it from a python pr

Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 11:05:23 -0400, Random832 wrote: > On Mon, Oct 31, 2016, at 10:55, Wildman via Python-list wrote: >> I have code using that approach but I am trying to save myself >> from having to parse the entire shadow file. Grep will do it >> for me if I can get co

Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 11:55:26 -0500, Wildman wrote: > On Mon, 31 Oct 2016 11:05:23 -0400, Random832 wrote: > >> On Mon, Oct 31, 2016, at 10:55, Wildman via Python-list wrote: >>> I have code using that approach but I am trying to save myself >>> from having to parse

Re: Call a shell command from Python

2016-10-31 Thread Wildman via Python-list
On Tue, 01 Nov 2016 12:08:52 +1100, Ben Finney wrote: > Wildman via Python-list writes: > >> On Mon, 31 Oct 2016 15:44:13 +1100, Ben Finney wrote: >> >> > One immediate difference I see is that you specify different >> > arguments to ‘grep’. You have

Re: Call a shell command from Python

2016-11-01 Thread Wildman via Python-list
On Tue, 01 Nov 2016 16:23:08 +1100, Ben Finney wrote: > Wildman via Python-list writes: > >> […] in this case grep never "sees" the '$' sign. Bash expands $USER to >> the actual user name beforehand. > > I understand how Bash substitutes variab

Re: Call a shell command from Python

2016-11-01 Thread Wildman via Python-list
On Tue, 01 Nov 2016 16:52:18 +1100, Steve D'Aprano wrote: > On Tue, 1 Nov 2016 04:00 pm, Wildman wrote: > >> You are correct about that but, in this case grep never "sees" the '$' >> sign. Bash expands $USER to the actual user name beforehand. If you >> are on a Linux system, enter this into a

Re: Call a shell command from Python

2016-11-01 Thread Wildman via Python-list
On Tue, 01 Nov 2016 13:42:03 +, Grant Edwards wrote: > On 2016-11-01, Steve D'Aprano wrote: >> On Tue, 1 Nov 2016 04:00 pm, Wildman wrote: >> >>> You are correct about that but, in this case grep never "sees" the '$' >>> sign. Bash expands $USER to the actual user name beforehand. If you >>

Re: Call a shell command from Python

2016-11-01 Thread Wildman via Python-list
On Tue, 01 Nov 2016 11:23:09 -0400, D'Arcy Cain wrote: > On 2016-11-01 01:23 AM, Ben Finney wrote: >> Wildman via Python-list writes: >> So the way your script was invoked has no bearing on whether Bash will >> get involved in what your script does. Your script is *dire

Re: Quick help for a python newby, please

2016-11-23 Thread Wildman via Python-list
On Wed, 23 Nov 2016 06:18:38 -0800, jones.dayton wrote: > I'm just learning, so please excuse my ignorance for > what I know is a simple issue... > > I'm writing a "Hello, World" type of script to see how > things work in python3. I'm asking for input to get a > person's birthday, then I want to

Re: Quick help for a python newby, please

2016-11-23 Thread Wildman via Python-list
On Thu, 24 Nov 2016 11:59:17 +1100, Chris Angelico wrote: > On Thu, Nov 24, 2016 at 10:02 AM, Wildman via Python-list > wrote: >> Try the code that is below: >> >> import datetime >> from datetime import date >> >> today = date.today() >> person =

Re: Quick help for a python newby, please

2016-11-23 Thread Wildman via Python-list
On Thu, 24 Nov 2016 14:49:27 +1100, Chris Angelico wrote: > On Thu, Nov 24, 2016 at 2:41 PM, Wildman via Python-list > wrote: >> Point taken. I did miss the python3 part. >> >> I switched to raw_input because it handles an empty >> input. An empty input would

Request Help With Byte/String Problem

2016-11-29 Thread Wildman via Python-list
For the purpose of learning I am writing a script that will return different information about the Linux machine where it is running. Sort of like the inxi utility. Below is some code that I found that returns a list of the network interface devices on the system. It runs as is perfectly on Pyth

Re: Request Help With Byte/String Problem

2016-11-29 Thread Wildman via Python-list
On Tue, 29 Nov 2016 18:29:51 -0800, Paul Rubin wrote: > Wildman writes: >> names = array.array("B", '\0' * bytes) >> TypeError: cannot use a str to initialize an array with typecode 'B' > > In Python 2, str is a byte string and you can do that. In Python 3, > str is a unicode string, and if

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

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-02 Thread Wildman via Python-list
On Fri, 02 Dec 2016 15:11:18 +, Grant Edwards wrote: > I don't know what the "addr" array contains, but if addr is a byte > string, then the "int()" call is not needed, in Pythong 3, a byte is > already an integer: > > def format_ip(a): >return '.'.join(str(b) for b in a) > > add

Re: Request Help With Byte/String Problem

2016-12-03 Thread Wildman via Python-list
On Fri, 02 Dec 2016 19:39:39 +, Grant Edwards wrote: > On 2016-12-02, Wildman via Python-list wrote: >> On Fri, 02 Dec 2016 15:11:18 +, Grant Edwards wrote: >> >>> I don't know what the "addr" array contains, but if addr is a byte >>>

Detect Linux Runlevel

2016-12-05 Thread Wildman via Python-list
I there a way to detect what the Linux runlevel is from within a Python program? I would like to be able to do it without the use of an external program such as 'who' or 'runlevel'. -- GNU/Linux user #557453 The cow died so I don't need your bull! -- https://mail.python.org/mailman/listinfo/py

Re: Detect Linux Runlevel

2016-12-05 Thread Wildman via Python-list
On Mon, 05 Dec 2016 16:25:56 -0500, DFS wrote: > On 12/05/2016 03:58 PM, Wildman wrote: >> I there a way to detect what the Linux runlevel is from >> within a Python program? I would like to be able to do >> it without the use of an external program such as 'who' >> or 'runlevel'. > > > Why not

Re: Detect Linux Runlevel

2016-12-05 Thread Wildman via Python-list
On Mon, 05 Dec 2016 23:59:48 +0200, Marko Rauhamaa wrote: > Wildman : >> Thanks but I knew about systemctl. As I already said my goal is to do >> it without the use of an external program. > > Inspect: > >https://github.com/systemd/systemd/blob/master/src/systemctl/systemctl.c> > > In p

Re: Detect Linux Runlevel

2016-12-05 Thread Wildman via Python-list
On Mon, 05 Dec 2016 15:39:24 -0700, Michael Torrie wrote: > On 12/05/2016 03:34 PM, Wildman via Python-list wrote: >> Too bad I don't speak C. I am an amateur programmer and most or all >> my experience has been with assembly and various flavors of BASIC, >> including

Re: Detect Linux Runlevel

2016-12-05 Thread Wildman via Python-list
On Mon, 05 Dec 2016 16:08:57 -0600, Tim Chase wrote: > On 2016-12-05 14:58, Wildman via Python-list wrote: >> I there a way to detect what the Linux runlevel is from >> within a Python program? I would like to be able to do >> it without the use of an external progra

Re: Detect Linux Runlevel

2016-12-05 Thread Wildman via Python-list
On Mon, 05 Dec 2016 18:25:58 -0700, Michael Torrie wrote: > I think Python is a good choice for such a utility, but I agree it is > much better to rely on these external utilities as children to do the > platform-dependent work, rather than try to re-implement everything in > Python. A long time

Re: Detect Linux Runlevel

2016-12-05 Thread Wildman via Python-list
On Mon, 05 Dec 2016 20:46:22 -0700, Michael Torrie wrote: > On 12/05/2016 08:27 PM, Wildman via Python-list wrote: >> On Mon, 05 Dec 2016 18:25:58 -0700, Michael Torrie wrote: >> >>> I think Python is a good choice for such a utility, but I agree it is >>> much

Re: Detect Linux Runlevel

2016-12-05 Thread Wildman via Python-list
On Mon, 05 Dec 2016 21:42:52 -0600, Tim Chase wrote: > On 2016-12-05 18:26, Wildman via Python-list wrote: >> On Mon, 05 Dec 2016 16:08:57 -0600, Tim Chase wrote: >> >> > On 2016-12-05 14:58, Wildman via Python-list wrote: >> >> I there a way to de

Re: Detect Linux Runlevel

2016-12-06 Thread Wildman via Python-list
On Tue, 06 Dec 2016 01:14:35 +0100, Bernd Nawothnig wrote: > On 2016-12-05, Wildman wrote: >> And I am trying to write it without using external programs, where >> possible. > > That is not the Unix way. Yes, but it is my way. >> I am a hobby programmer and I've been trying to learn python >> f

Re: Detect Linux Runlevel

2016-12-06 Thread Wildman via Python-list
On Mon, 05 Dec 2016 16:08:57 -0600, Tim Chase wrote: > On 2016-12-05 14:58, Wildman via Python-list wrote: >> I there a way to detect what the Linux runlevel is from >> within a Python program? I would like to be able to do >> it without the use of an external progra

Re: Detect Linux Runlevel

2016-12-06 Thread Wildman via Python-list
On Tue, 06 Dec 2016 13:06:35 -0600, Tim Chase wrote: > On 2016-12-06 12:10, Wildman via Python-list wrote: >> If I had tried this in the beginning, it would have >> save you a lot of work. >> >> Since both versions of the code works, which one do >> you recomm

Re: Detect Linux Runlevel

2016-12-06 Thread Wildman via Python-list
On Tue, 06 Dec 2016 09:45:05 -0700, Michael Torrie wrote: > I appreciate your measured response to what could be seen as an > inflammatory post. It was inflammatory and I considered a different response but after the knee jerking, I give it some thought and decided otherwise. The simple fact is

Re: Detect Linux Runlevel

2016-12-06 Thread Wildman via Python-list
On Tue, 06 Dec 2016 13:06:35 -0600, Tim Chase wrote: > I forgot to mention that I want to include your name in the final script as a contributor, if that is ok. You will get a cut of the royalties. Lets see, how much is 20% of $0.00? Well, I'll let my account work that out as soon as she gets

Re: CLP stats: last 500 posts

2016-12-10 Thread Wildman via Python-list
On Fri, 09 Dec 2016 16:07:16 -0500, DFS wrote: > code (py2.7) > -- > import sys as y,nntplib as t,datetime as d > s='' > g=y.argv[1] > n=t.NNTP(s,119,'','') > r,a,b,e,gn=n.group(g) > def printStat(st,hd,rg): > r,d=n.xhdr(st,'%s-%s'%

Re: CLP stats: last 500 posts

2016-12-10 Thread Wildman via Python-list
On Sat, 10 Dec 2016 12:31:33 -0500, DFS wrote: > On 12/10/2016 12:06 PM, Wildman wrote: >> On Fri, 09 Dec 2016 16:07:16 -0500, DFS wrote: >> >>> code (py2.7) >>> -- >>> import sys as y,nntplib as t,datetime as d >>> s='' >>> g=y.argv[1] >

Re: CLP stats: last 500 posts

2016-12-11 Thread Wildman via Python-list
On Sat, 10 Dec 2016 12:31:33 -0500, DFS wrote: > After correcting my stupid oversights, the code runs fine up to the point where the user agents are printed. I get an error saying that 'User-Agent' is an unsupported header field. It must have something to do with giganews. If I use aioe.org I

Re: CLP stats: last 500 posts

2016-12-11 Thread Wildman via Python-list
On Sun, 11 Dec 2016 12:03:07 -0500, DFS wrote: > For this short stat version I only used the 'User-Agent' header. I have > a longer version that uses both 'User-Agent' and 'X-Newsreader' > > > You can put a conditional in place for now: > > if s='giganews': > printStat("X-Newsreader","N

Re: Problem running Python 3.5.2 on school network PC

2016-12-15 Thread Wildman via Python-list
On Thu, 15 Dec 2016 11:11:51 -0500, Jed Mack wrote: > We are having a problem running Python 3.5.2 on Windows 10 x64 computers, > which are members of a school network. > > > > The program seems to install correctly, but when we try to run the program > it stops and give an error message saying

Re: learning and experimenting python.

2016-12-30 Thread Wildman via Python-list
On Fri, 30 Dec 2016 11:08:30 -0800, einstein1410 wrote: > LAN you are right. I am agree with you that it's easy to recognise. > > But look > $ for normal user > # for special user/root > % for other shell For python > And so on... > Why? > Why their developer selected that? > Is there any s

Re: learning and experimenting python.

2016-12-30 Thread Wildman via Python-list
On Fri, 30 Dec 2016 15:34:16 -0800, einstein1410 wrote: > You are also confusing me. > But there mustbe some reason. > What happens if your student questions you like this.? I am not a teacher. > And may be those who questions like this will surely be the developer of its > successor language.

Re: learning and experimenting python.

2016-12-30 Thread Wildman via Python-list
On Fri, 30 Dec 2016 23:39:43 +, Erik wrote: > On 30/12/16 23:34, einstein1...@gmail.com wrote: >> You are also confusing me. >> But there mustbe some reason. >> What happens if your student questions you like this.? >> And may be those who questions like this will surely be the developer of i

Re: learning and experimenting python.

2016-12-30 Thread Wildman via Python-list
On Fri, 30 Dec 2016 19:23:17 -0700, Michael Torrie wrote: > On 12/30/2016 07:05 PM, Wildman via Python-list wrote: >> On Fri, 30 Dec 2016 23:39:43 +, Erik wrote: >> >>> On 30/12/16 23:34, einstein1...@gmail.com wrote: >>>> You are also confusing me

Re: learning and experimenting python.

2017-01-01 Thread Wildman via Python-list
On Sun, 01 Jan 2017 10:41:22 -0800, einstein1410 wrote: > What contribution I had made especially valuable? Ask your mommy what sarcasm means. -- GNU/Linux user #557453 The cow died so I don't need your bull! -- https://mail.python.org/mailman/listinfo/python-list

Re: learning and experimenting python.

2017-01-02 Thread Wildman via Python-list
On Sun, 01 Jan 2017 23:02:34 -0800, einstein1410 wrote: > I really don't care the person like you. > Leave my posts, if don't like it. > Why wasting your as well as my time. > Just get lost man, or shut up. _ _ |_| |_| | | /^^^\

Re: learning and experimenting python.

2017-01-03 Thread Wildman via Python-list
On Mon, 02 Jan 2017 20:25:25 -0800, Ethan Furman wrote: > On 01/02/2017 09:53 AM, Wildman via Python-list wrote: > > [rude ascii art omitted] > > That is a completely inappropriate response. Yes it was. I tend to get upset when told to shut up and go away for no good reason.

Re: How coding in Python is bad for you

2017-01-23 Thread Wildman via Python-list
On Mon, 23 Jan 2017 20:39:26 +, Jon Ribbens wrote: > On 2017-01-23, alister wrote: >> On Tue, 24 Jan 2017 07:19:42 +1100, Chris Angelico wrote: >>> I believe that's "bad for you" in the sense that chocolate is bad for >>> you. >>> >>> It isn't. >> >> chocolate is a poison (lethal dose for a

Re: Is shutil.get_terminal_size useless?

2017-01-29 Thread Wildman via Python-list
On Sat, 28 Jan 2017 19:03:42 +1100, Steve D'Aprano wrote: > shutil.get_terminal_size returns the wrong values when you pipe your output > to another process, even it you do so in a terminal. Consider this script: > > > import os > import shutil > print('shutil:', shutil.get_terminal_size(fallbac

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Wildman via Python-list
On Wed, 01 Feb 2017 17:12:26 +, Chris Green wrote: > I'm often hitting this problem, how does one find out what package to > install to provide what a give import needs? > > Currently I'm modifying some code which has 'import gtk', I want to > migrate from Python 2 to Python 3 if I can but at

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Wildman via Python-list
On Wed, 01 Feb 2017 19:15:13 +, Chris Green wrote: > Wildman wrote: >> On Wed, 01 Feb 2017 17:12:26 +, Chris Green wrote: >> >> > I'm often hitting this problem, how does one find out what package to >> > install to provide what a give import needs? >> > >> > Currently I'm modifying som

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Wildman via Python-list
On Wed, 01 Feb 2017 21:29:00 +, Chris Green wrote: > Wildman wrote: >> On Wed, 01 Feb 2017 19:15:13 +, Chris Green wrote: >> >> > Wildman wrote: >> >> On Wed, 01 Feb 2017 17:12:26 +, Chris Green wrote: >> >> >> >> > I'm often hitting this problem, how does one find out what package

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Wildman via Python-list
On Fri, 03 Feb 2017 11:06:00 -0500, Neal Becker wrote: > I want to make sure any modules I build in the current directory overide any > others. To do this, I'd like sys.path to always have './' at the beginning. > > What's the best way to ensure this is always true whenever I run python3? In p

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Wildman via Python-list
On Fri, 03 Feb 2017 12:58:15 -0600, Wildman wrote: > On Fri, 03 Feb 2017 11:06:00 -0500, Neal Becker wrote: > >> I want to make sure any modules I build in the current directory overide any >> others. To do this, I'd like sys.path to always have './' at the beginning. >> >> What's the best way

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Wildman via Python-list
On Fri, 03 Feb 2017 13:19:30 -0700, Michael Torrie wrote: > On 02/03/2017 12:07 PM, Wildman via Python-list wrote: >> Sorry, I forgot something important. If you use >> /etc/rc.local, the execute bit must be set. > > I don't think this is what Neal Becker was asking ab

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Wildman via Python-list
On Sat, 04 Feb 2017 09:25:42 +1100, Cameron Simpson wrote: > On 03Feb2017 14:55, Wildman wrote: >>On Fri, 03 Feb 2017 13:19:30 -0700, Michael Torrie wrote: >> >>> On 02/03/2017 12:07 PM, Wildman via Python-list wrote: >>>> Sorry, I forgot something important.

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Wildman via Python-list
On Sat, 04 Feb 2017 11:27:01 +0200, Jussi Piitulainen wrote: > Wildman writes: > > [snip] > >> If anyone is interested the correct way is to add this to >> /etc/profile (at the bottom): >> >> PATH=$PATH:./ >> export PATH > > Out of interest, can you think of a corresponding way that a mere user

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Wildman via Python-list
On Sat, 04 Feb 2017 18:25:03 +, Grant Edwards wrote: > On 2017-02-04, Wildman via Python-list wrote: > >> No, I do not know. You might try your question in a linux specific >> group. Personally I don't understand the danger in having the dot >> in the p

Re: best way to ensure './' is at beginning of sys.path?

2017-02-05 Thread Wildman via Python-list
On Sat, 04 Feb 2017 19:12:55 +, Grant Edwards wrote: > On 2017-02-04, Wildman via Python-list wrote: >>> >>> The next time you are in the /tmp directory looking for something, can >>> you guess what happens when you mistype "ls" as "sl"?

Re: best way to ensure './' is at beginning of sys.path?

2017-02-05 Thread Wildman via Python-list
On Mon, 06 Feb 2017 09:07:34 +1100, Steve D'Aprano wrote: > On Sun, 5 Feb 2017 07:01 pm, Wildman wrote: > >> Sure, you >> could trick someone into running a program that could >> mess with $HOME but that is all.  For anyone, like me, >> that makes regular backups, that is not a big problem. >> To

Re: Help with python code

2016-03-29 Thread Wildman via Python-list
On Tue, 29 Mar 2016 21:19:05 +, Rob Gaddi wrote: >> menu = input("Enter the type of pizza that you want to order from 1-5 \n") >> while menu>5 or menu <=0: >> menu = input ("Enter the right number ") >> pizza_cost = pizzatype[menu] As it has already been pointed out, a Python list starts

Re: pygtk button right/middle click

2016-03-30 Thread Wildman via Python-list
On Wed, 30 Mar 2016 15:36:12 +, Grant Edwards wrote: > I'm trying to figure out how to get a pygtk button respond to > somehting other than just a simple "left click". With a standard > 3-button mouse, X11 provides at least 9 different "click" types, but > the pygtk button only seems to suppo

Re: pygtk button right/middle click

2016-03-30 Thread Wildman via Python-list
On Wed, 30 Mar 2016 19:23:35 +, Grant Edwards wrote: > On 2016-03-30, Grant Edwards wrote: >> On 2016-03-30, Wildman wrote: >> Is the gtk button widget really incapable of handling left or middle mouse buttons or shift/ctrl/alt modifiers? >>> >>> This might help... >>> >>> http://f

Re: tkinter Entry validation modes

2016-04-02 Thread Wildman via Python-list
On Sat, 02 Apr 2016 16:11:19 +0100, Mark Lawrence wrote: > A typical call to create an Entry field would be:- > > e = Entry(master, validate='all', ...) > > Once this call has been made is it possible to change the validation > mode at runtime? Background, I'm knocking up an app so I can play

  1   2   3   >