Re: Question about garbage collection

2024-01-15 Thread Akkana Peck via Python-list
I wrote: > > Also be warned that some modules (particularly if they're based on > > libraries not written in Python) might not garbage collect, so you may need > > to use other methods of cleaning up after those objects. Chris Angelico writes: > Got any examples of that? The big one for me was

Re: Question about garbage collection

2024-01-15 Thread Akkana Peck via Python-list
> Frank Millman wrote at 2024-1-15 15:51 +0200: > >I have read that one should not have to worry about garbage collection > >in modern versions of Python - it 'just works'. Dieter Maurer via Python-list writes: > There are still some isolated cases when not all objects > in an unreachable cycle

Re: Behavior of the for-else construct

2022-03-03 Thread Akkana Peck
computermaster360 writes: > I want to make a little survey here. > > Do you find the for-else construct useful? No. > Have you used it in practice? Once or twice, but ended up removing it, see below. > Do you even know how it works, or that there is such a thing in Python? I always have to

Re: Best way to check if there is internet?

2022-02-23 Thread Akkana Peck
2qdxy4rzwzuui...@potatochowder.com writes: > I think someone said it way upthread: don't check, just do whatever you > came to do, and it will work or it will fail (presumably, your program > can tell the difference, regardless of a past snapshot of being able to > retrieve data from an arbitrary

Re: Best way to check if there is internet?

2022-02-09 Thread Akkana Peck
Abdur-Rahmaan Janhangeer writes: > results = [] > with console.status("Checking internet ...", spinner="dots"): > for domain in domains: > try: > requests.get(domain) > results.append(1) > except Exception as e: > results.append(0) > if not any(results): > print('No internet connection') >

[issue45802] MozillaCookieJar can't read cookies, should support cookies.sqlite

2021-11-13 Thread Akkana Peck
New submission from Akkana Peck : http.cookiejar.MozillaCookieJar only reads from cookies.txt, a format that Mozilla hasn't used in over a decade. It should read the file mozilla actually uses, cookies.sqlite. Here's some code that works to turn cookies.sqlite into cookies.txt in order

Re: Selenium py3.8+ DepreciationWarnings - where to find doc to update code?

2021-10-16 Thread Akkana Peck
jkk writes: > Selenium 3.141+ > python 3.8+ > ubuntu 20.04 or windows 10 > > I'm trying to upgrade code from py3.6+ to py3.8+ and I'm getting several > DepreciationWarnings. > > Can someone point me to where I can find the documentation that explains how > to to remedy these warnings. What are

Re: XAMPP control panel python

2021-07-19 Thread Akkana Peck
Mike Easter writes: > the CP readme says: > > To run the XAMPP Control Panel, you will need: > > Linux (may work on other OSs) > GTK 2.x > PyGTK (also known as python-gtk) 2.x > XAMPP > > I installed py2 to my Linux Mint Cinnamon 20.2 (off Ub LTS 20.04) but that > didn't

Re: Replacement for pygtk?

2020-09-05 Thread Akkana Peck
Grant Edwards writes: > Is pygobject the replacement for pygtk? The easiest way to use it, if you want a quick port with the fewest code changes, is: from gi import pygtkcompat pygtkcompat.enable() pygtkcompat.enable_gtk(version='3.0') I don't know if pygtkcompat is going to be supported

Re: What kind of magic do I need to get python to talk to Excel xlsm file?

2020-09-01 Thread Akkana Peck
Steve writes: > Glutton for punishment, I am looking into designing another .py program. I > would like to pull two columns of information from Excel but the more I look I've found the xlrd module easy to use for extracting data from Excel files. But I've only used it on .xsl and .xsls. I've

Re: How to remove "" from starting of a string if provided by the user

2020-08-11 Thread Akkana Peck
> > On 2020-08-11 02:20, Ganesh Pal wrote: > > > How do I check if it the value was (a) i.e string started and ended > > > with a quote Of course the original question was simple and there have been lots of solutions given. But I find this comes up periodically, and I'm always leery of using

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-07 Thread Akkana Peck
I wrote: > > > Trying to maintain that recursive list of unclosed lists in your > > > brain is fun. It stretches the brain in interesting ways. > > > [ ... ] But I never found Lisp code very maintainable, [ ... ] 2qdxy4rzwzuui...@potatochowder.com writes: > "[R]ecursive list of unclosed lists"?

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-06 Thread Akkana Peck
Christian Seberino writes: > Python is my favorite language and the easiest to use in my opinion. > > Lisp has a far simpler grammar and syntax. A beginner I think could > learn Lisp much faster than Python. > > Therefore, it seems like Lisp *should* be easier to work with and more >

Re: Need to 'import gtk' on Ubuntu 20.04, what do I need?

2020-07-23 Thread Akkana Peck
Chris Green writes: > I have recently upgraded my desktop system from ubuntu 19.10 to ubuntu > 20.04. [ ... ] > The error I am getting is:- [ ... ] > ImportError: No module named gtk > > So what do I need to install on my Ubuntu 20.04 system to provide the > gtk module? Ubuntu doesn't

Re: Troubleshooting

2019-12-13 Thread Akkana Peck
Michael Torrie writes: > On 12/12/19 6:33 PM, Python wrote: > > What happened exactly? Did you download the official installer from > > python.org, then click on next, next, next, checking the box (if it's > > still there about updating PATH)? There is nothing more to do. > > I've seen github bug

Testing a TestPyPI package with dependencies

2019-12-09 Thread Akkana Peck
I'm a novice packager, trying to test a package I built and uploaded to TestPyPI. It has dependencies and I want to make sure my setup.py works before uploading to the real PyPI. https://packaging.python.org/guides/using-testpypi/ says that if a package has dependencies, to use this command to

Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Akkana Peck
Chris Angelico writes: > On Thu, Nov 21, 2019 at 4:42 AM Nick Sarbicki > wrote: > > RE Conda and distros - I'd forget about them, in my experience you may as > > well learn to use pip and install what you need that way, in the long term > > Agreed. More agreement. Someone at the local

Re: question about making an App for Android

2019-10-11 Thread Akkana Peck
> pyotr filipivich > >"A simple program" to divide the amount of "today's" daylight into 12 > >even '"hours", so that Dawn begins the First hour, the third hour is > >mid-morning, noon is the middle of the day, the ninth hour mid after > >noon, and the twelfth hour ends at sunset. Is simple, no?

Re: Handle foreign character web input

2019-06-28 Thread Akkana Peck
On Sat, Jun 29, 2019 at 6:31 AM Tobiah wrote: > Also, what do people do when searching for a record. > Is there some way to get 'Ronngren' to match the other > possible foreign spellings? SequenceMatcher in difflib can do fuzzy string comparisons and should work for cases like that. There are

Re: Friday Filosofical Finking: Import protections

2019-04-18 Thread Akkana Peck
Chris Angelico writes: > Actually, only the Python interpreter has to be able to do those > steps. That's why I put the comment *on the same line* as the import > statement (not immediately above it, for instance). It comes out like > this: > > (env) rosuav@sikorsky:~/shed$ python3

Re: Friday Filosofical Finking: Import protections

2019-04-18 Thread Akkana Peck
Chris Angelico writes: > I write this as: > > import whois # ImportError? pip install python-whois [ ... ] > it means that normal exception handling is still > happening (which might be important if I import this into something > else), plus it's printing the message to stderr rather than stdout

Re: Friday Filosofical Finking: Import protections

2019-04-18 Thread Akkana Peck
DL Neil writes: > On 18/04/19 8:44 AM, Grant Edwards wrote: > > 2. When the program can still do something useful (if perhaps > > feature-limited) without the imported module by substituting > > something else in its place. > > Any (publishable) examples? One of the targets my RSS

Re: Handy utilities = Friday Filosofical Finking

2019-03-29 Thread Akkana Peck
DL Neil writes: > How do you keep, use, and maintain those handy snippets, functions, > classes... - units of code, which you employ over-and-over again? Fun topic! I have two methods: First, in my scripts directory I have a file called "python-cheatsheet.py" where I save small tips that I

Re: I wrote a free book about TDD and clean architecture in Python

2019-03-20 Thread Akkana Peck
> 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

Re: What is your experience porting Python 2.7.x scripts to Python 3.x?

2019-01-22 Thread Akkana Peck
Grant Edwards writes: > On 2019-01-22, Schachner, Joseph wrote: > > > For anyone who has moved a substantial bunch of Python 2 to Python > > 3, can you please reply with your experience? > > If you used bytes (or raw binary strings) at all (e.g. for doing > things like network or serial

Re: get the terminal's size

2019-01-16 Thread Akkana Peck
> On Mon, 14 Jan 2019 11:57:33 +, Alex Ternaute wrote: > > > Hi there, > > > > I want to know the number of columns of the terminal where python2 writes > > it's outputs. A couple days late to the party, a discussion of several ways I tried:

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Akkana Peck
Grant Edwards writes: > This is what "archive" file formats are for. Just use tar, zip, ar, > cpio, or some other file format designed to store multiple "files" of > arbitrary data -- there are plenty of "standard" formats to choose > from and plenty of libraries to deal with them. Then the

Re: Accessing clipboard through software built on Python

2018-10-28 Thread Akkana Peck
Tim Daneliuk writes: > However, the highlighted text must be copied explicitly: > > Highlight > Ctl-C [ ... ] > X actually has several clipboard buffers and it can be tricky to get this > going. I don't recall, > but either clipboard or pyperclip have a way to get to them all IIRC ... To get

Re: Hi I'm trying to get live data from stock using python , is it possible?

2018-09-04 Thread Akkana Peck
Skip Montanaro writes: > > I want to know if AAPL is more than value 300 and if it does I want it to > > send to me mail with gmail :) . thanks for the help.. > > Try searching pypi.org for "finance", then scroll through the many > returned packages. A few show how to get stock data from Yahoo!

Re: Writing bytes to stdout reverses the bytes

2018-08-20 Thread Akkana Peck
> Thomas Jollans : > > Wonderful. Now why don't we all forget about hexdump and use xxd? ;-) Marko Rauhamaa writes: > Fedora: > >$ xxd >bash: xxd: command not found >$ hd >bash: hd: command not found >$ od -Ax -tx1z -v <<00 68 65 6c 6c 6f 0a

Re: How to decide (and know) which Python GTK version to use?

2018-07-30 Thread Akkana Peck
Chris Green writes: > I wrote a Python GUI program a little while ago that uses Python GTK > with:- > > import gtk > > I *think* this is probably GTK 2, or something. I can't find the > proper documentation for this. Is it old/obsolescent? Yes, it's obsolete, and AFAIK it only works with

Re: ongoing browser projects

2018-07-23 Thread Akkana Peck
> > On 23/07/18 03:43, Akkana Peck wrote: > >> You'd think there would be something newer (ideally > >> based on Blink) that worked with GTK3/GIO, but I never found anything. Thomas Jollans writes: > > This gi-based example looks like Gtk3, right? > > http

Re: ongoing browser projects

2018-07-22 Thread Akkana Peck
> On 22/07/18 21:43, Abdur-Rahmaan Janhangeer wrote: > > i need an html renderer (one of the most badly missed features of py, PEP > > anyone?) I think both GTK and Qt have basic HTML rendering widgets, for simple tasks, but if you want something that behaves more like a browser (javascript, link

Re: Multi-threading with a simple timer?

2018-07-03 Thread Akkana Peck
David D wrote: > Is there a SIMPLE method that I can have a TIMER count down at a user input > prompt - if the user doesn't enter information within a 15 second period, it > times out. Does this do what you want? from threading import Timer import sys import os def run_later(): print("Timed

[issue5978] cProfile and profile don't work with pygtk/pyqt and sys.exit(0)

2009-05-09 Thread Akkana Peck
New submission from Akkana Peck akkzi...@shallowsky.com: I was following the steps at http://docs.python.org/library/profile.html to try to profile a pygtk program, but it wasn't working -- I was getting no output at all from either cProfile or profile. The problem turned out to be that I