python

Is Active
On

Python's Sendmail fails due to access permissions

A script that ran happily for about a year suddenly stopped working last week. From the stack trace, it was apparent that the script was stumbling on Python's smtplib>sendmail command. Here's the error: OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions The offending code: s = smtplib.SMTP(config['smtpserver']['server']) s.sendmail(fromAddress, toAddress, msg.as_string()) The best suggestion I found is that Windows UAC is likely preventing the successful sendmail[^1].

Toggling a Network Adapter with Python 3

if you frequently have to toggle between two network adapters in Windows, it can become a hassle to keep opening the Control Panel widget, right-click, disable/enable adapter, etc. For example, you may want to turn off your wired connection and connect to wifi, then switch back to wired, etc. With Python and this 'admin' library (also attached to this post for download), you can just place a shortcut on the desktop and double-click to enable/disable a particular adapter.

Collecting new document files for easy attachment in email

I find that I frequently (many times daily) have to send files as email attachments. Depending on the task, the files can be located in a half-dozen or so places on the Windows file system. I found myself browsing (from Outlook's "Attach File" function) to my Documents, Downloads, Desktop, or one of several network drives for the file I just saved there a few seconds ago. I had the idea that those folders could all be monitored, with copies of the most recent files from each kept in a single place.

Change pip package dependency lists and install from local source with Python 3.6

When installing a Python 3 package with Pip, if the package to be installed calls for a dependency that is outdated or otherwise not available, you can get a local copy of the module, change its dependency lists, then install it from the local source. This will likely be no big deal for the Python wizards out there, but it was a pretty nice victory for me, so I thought I'd better share in case someone else has the same trouble.

Tags