Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Tomorrow's computers some time next month. -- DEC


devel / comp.lang.python / Python Launcher Pops Up When Py-based App Is Running (Mac)

SubjectAuthor
o Python Launcher Pops Up When Py-based App Is Running (Mac)James Greenham

1
Python Launcher Pops Up When Py-based App Is Running (Mac)

<mailman.318.1695008082.23016.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24014&group=comp.lang.python#24014

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news-2.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: cooler...@icloud.com (James Greenham)
Newsgroups: comp.lang.python
Subject: Python Launcher Pops Up When Py-based App Is Running (Mac)
Date: Sun, 17 Sep 2023 04:20:56 +0300
Lines: 508
Message-ID: <mailman.318.1695008082.23016.python-list@python.org>
References: <B71CBFF3-27FD-48D0-A605-B891E8BFE076@icloud.com>
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\))
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de yQ+PFYPuZu17ruH7wj/Rog7ywgMVnCElf3yrxS3THUZw==
Cancel-Lock: sha1:RFLC45TXKj9UApwD39uBw5yKV+4= sha256:jQrpZW1Kkg97mHMisiscBpSOeDZ6BDIg3ebm97IIIS4=
Return-Path: <cooler9.t@icloud.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=icloud.com header.i=@icloud.com header.b=oa6qVzgv;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'looks': 0.02; 'def': 0.04;
'bigger': 0.05; 'usage': 0.05; 'correct?': 0.07; 'importerror:':
0.07; 'modification': 0.07; 'persons': 0.07; 'string': 0.07;
'utf-8': 0.07; '"as': 0.09; '2.7': 0.09; 'apparently': 0.09;
'binaries': 0.09; 'blank': 0.09; 'elif': 0.09; 'else:': 0.09;
'line:': 0.09; 'macos': 0.09; 'md5': 0.09; 'message-
id:@icloud.com': 0.09; 'parse': 0.09; "shouldn't": 0.09; 'skip:[
20': 0.09; 'subject:App': 0.09; 'window.': 0.09; 'subject:Python':
0.12; 'log': 0.12; 'downloaded': 0.13; '&gt;': 0.14; 'import':
0.15; '"cannot': 0.16; '"software"),': 0.16; '#if': 0.16; '&gt;=':
0.16; '(default:': 0.16; '-*-': 0.16; '...]': 0.16; '2.7.': 0.16;
'[options]': 0.16; 'args[0]': 0.16; 'arguments': 0.16; 'avila':
0.16; 'below).': 0.16; 'captured': 0.16; 'charge,': 0.16;
'coding:': 0.16; 'conditions:': 0.16; 'contract,': 0.16;
'dealings': 0.16; 'displays': 0.16; 'distribute,': 0.16;
'encoding': 0.16; 'filename': 0.16; 'finishing': 0.16;
'furnished': 0.16; 'generates': 0.16; 'granted,': 0.16; 'hash':
0.16; 'holders': 0.16; 'inactive': 0.16; 'is",': 0.16; 'kind,':
0.16; 'liability,': 0.16; 'main()': 0.16; 'merge,': 0.16;
'modify,': 0.16; 'not)': 0.16; 'permitted': 0.16; 'portions':
0.16; 'publish,': 0.16; 'received:17.58.63': 0.16;
'received:17.58.63.174': 0.16; 'received:st43p00im-
ztbu10063601.me.com': 0.16; 'restriction,': 0.16; 'size)': 0.16;
'skip:" 70': 0.16; 'stuck': 0.16; 'subject:Mac': 0.16;
'sublicense,': 0.16; 'todo:': 0.16; 'tort': 0.16; 'turns': 0.16;
'urls': 0.16; 'warranties': 0.16; 'problem': 0.16; 'python': 0.16;
'larger': 0.17; 'url': 0.19; 'option': 0.20; 'issue': 0.21;
'i.e.': 0.22; 'code': 0.23; 'command': 0.23; 'installed': 0.23;
'(and': 0.25; 'anything': 0.25; 'python,': 0.25; 'cannot': 0.25;
'seems': 0.26; 'contents.': 0.26; 'library': 0.26; 'object': 0.26;
'function': 0.27; 'old': 0.27; 'etc': 0.28; 'output': 0.28;
'purpose': 0.28; 'goes': 0.28; 'wrong': 0.28; 'environment': 0.29;
'it,': 0.29; 'error': 0.29; 'whom': 0.30; 'url-ip:lookup error':
0.70; '1000': 0.70; 'skip:a 40': 0.70; 'skip:f 30': 0.71; 'care':
0.71; 'content': 0.72; 'free': 0.72; 'deal': 0.73; 'skip:f 20':
0.75; 'rights': 0.76; 'delegate': 0.76; 'domain': 0.77; '(c)':
0.81; 'constitute': 0.81; 'fitness': 0.81; 'paul': 0.81;
'happens': 0.84; 'copyright': 0.84; '(like': 0.84; 'capture':
0.84; 'pasting': 0.84; 'safari': 0.84; 'saves': 0.84;
'seamlessly': 0.84; 'skip:o 60': 0.84; 'skip:w 50': 0.84; 'skip:w
70': 0.84; 'skip:w 80': 0.84; 'subject:based': 0.84; 'this)':
0.84; '"";': 0.91; 'largely': 0.91; 'skip:a 60': 0.91; 'width':
0.91; 'screenshots': 0.93; 'skip:b 50': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com;
s=1a1hai; t=1694957012;
bh=sWe3AY/NRrJvw1h57RyVfDUbTqLuYjW9bsZDmjWDY3A=;
h=From:Content-Type:Mime-Version:Date:Subject:To:Message-Id;
b=oa6qVzgvhrkClNIy9+dFEHLcbrTm+HQedS9YzahiwGsNMjan/2HOIWGK86+e/2lOD
1reQoT7DJCzSYIr4ZXtFkQqJ1Unaiy6zUktCz9YhPMwwEj5ziMMy6T32wtsu5EJEps
VQO3unu47blJ8wH4Q0ocXmbToKUr/W0XtCzj84Y7r2a82PTHL1qwG/ONJfHrwi8L2L
DlyRRSmDj4DIqOcEmalxXVKyLOGv07tGE0/I8akT3e3KQUe0cVM6e4d5pRy3KJKswR
LHuCxIsNPWfG05pk/n3C+UWyke7SfFfGrIczVVGUebvWsQxC3+TGN+olItl/FRfBcO
LFQsw7+bkzung==
Resent-Date: Sun, 17 Sep 2023 16:23:27 +0300
Resent-From: James Greenham <cooler9.t@icloud.com>
Resent-To: python-list@python.org
X-Mailer: Apple Mail (2.3445.104.21)
X-Proofpoint-GUID: Df-eedM46DOqyx_OXIYYlLbFOThhUbCa
X-Proofpoint-ORIG-GUID: Df-eedM46DOqyx_OXIYYlLbFOThhUbCa
X-Proofpoint-Virus-Version: vendor=fsecure_engine=1.1.170-22c6f66c430a71ce266a39bfe25bc
2903e8d5c8f:6.0.573,18.0.572,17.0.605.474.0000000_definitions
=2023-05-17_02:2023-05-17_02,2020-02-14_11,2020-01-23
_02_signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0
adultscore=0
phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1011 spamscore=0
bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1
engine=8.12.0-2212070000 definitions=main-2309170121
Resent-Message-Id: <4RpTCB0CLVznVGc@mail.python.org>
X-Mailman-Approved-At: Sun, 17 Sep 2023 23:34:40 -0400
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <B71CBFF3-27FD-48D0-A605-B891E8BFE076@icloud.com>
 by: James Greenham - Sun, 17 Sep 2023 01:20 UTC

Hello,

On the face of it, the Python-Mac mailing list is largely inactive so I'm posting here since it looks like this one is livelier.

I'm running macOS Mojave with Python 2.7. I have an old Dashboard widget (last modified in 2009) that appears to use Python as well. The widget captures the full Safari web-page. It works seamlessly on earlier macOS systems but hangs in 10.14. The widget's core functions constitute code of the script that I'm pasting in this message. The problem is that as soon as the execution reaches the image processing stage it gets stuck which manifests by Python Launcher popping up in Dock and is trying forever until I quit the launcher that force-quits the widget showing the error icon.

The issue seems to originate in the doGrab handler (module or whatever the correct Python term fits the definition) immediately following the print "Processing Image..." line: it's the message the widget displays at getting stalled. I( checked that Python 2.7 is installed in the default location at /usr/bin. I also have the binaries idle3, idle3.10, pip3, pip3.10 in /usr/local/bin, apparently used by another Unix program.

Is that remedied? The script's environment set to python, i.e. to python 2.7 so that shouldn't be the encumbrance. Am I correct?

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# OR:
# coding=utf-8

__version__ = "0.6"

#
# Based on Paul Hammond's webkit2png script - make screenshots of webpages
# http://www.paulhammond.org/webkit2png <http://www.paulhammond.org/webkit2png>
# # Modified by Paulo Avila for the Page Capture widget
# # The original source code (v0.5) belongs to Paul Hammond (see notice below).
# Any and all code added after is Copyright (c) 2009 Paulo Avila.
# # Modification Log by Paul Avila
# # 2009.04.21 - Changed almost all the output messages in order to behave properly with my Page Capture widget
# 2009.04.21 - Added function headers
# 2009.04.21 - Properly flush the output buffers so that messages display immediately
# 2009.04.21 - Changed encoding of this file to UTF-8
# 2009.04.25 - Updated how files are named: "<domain> > <file>.png"
# 2009.04.25 - Files are now named with the full URL excluding protocol (http://) and arguments (...?*)
#

# Copyright (c) 2009 Paul Hammond
# # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# # The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
import sys
import optparse

try:
import Foundation
import WebKit
import AppKit
import objc
except ImportError:
#print "Cannot find pyobjc library files. Are you sure it is installed?"
print "Mac OS X 10.5 or higher is required."
sys.stdout.flush()
sys.exit()

class AppDelegate (Foundation.NSObject):
# what happens when the app starts up
def applicationDidFinishLaunching_(self, aNotification):
webview = aNotification.object().windows()[0].contentView()
webview.frameLoadDelegate().getURL(webview)

class WebkitLoad (Foundation.NSObject, WebKit.protocols.WebFrameLoadDelegate):
# what happens if something goes wrong while loading
def webView_didFailLoadWithError_forFrame_(self,webview,error,frame):
#print " ... something went wrong"
print "Unable to load WebKit."
sys.stdout.flush()
self.getURL(webview)
def webView_didFailProvisionalLoadWithError_forFrame_(self,webview,error,frame):
#print " ... something went wrong"
print "Check URL or Internet connection."
sys.stdout.flush()
self.getURL(webview)

#---------------------------------------------------
#7 - Generates the filename.

def makeFilename(self,URL,options):
# make the filename
if options.filename:
filename = options.filename
elif options.md5:
try:
import md5
except ImportError:
print "--md5 requires python md5 library"
sys.stdout.flush()
AppKit.NSApplication.sharedApplication().terminate_(None)
filename = md5.new(URL).hexdigest()
else:
import re
# filename = re.sub('\W','',URL); #\W is the same as [^a-zA-Z0-9_]

#--------
#remove anything after (and including) a question mark
URL = re.sub("\?.*$", "", URL);
#arg = URL.find("?");
#if arg >= 0:
# URL = URL[0:arg];

#remove the protocol string in the beginning (SSL or not)
URL = re.sub("^https?://", "", URL);

#-- Page Capture # (start)
import os
dir = os.path.abspath(os.path.expanduser(options.dir));

count = 1;
while os.access(dir + "/Page Capture " + str(count) + ".png", os.F_OK):
count += 1;

filename = "Page Capture " + str(count);
#-- Page Capture # (end)

#-- Full URL (start)
#replace forward slashes with colons to allow to forward slashes in the filename (OS X's HFS+ allows for this)
# filename = re.sub("/", ":", URL);

#max filename length permitted is 255. (255 - 4 = 251). (4 is the length of the extenion '.png')
# if len(filename) > 251:
# filename = filename[0:248] + "...";
#-- Full URL (end)

#-- Domain > File (start)
# URL = URL.split("/");

#isolate just the domain
# domain = URL[0];
#domain = re.sub("/.*$", "", URL);
#domain = URL[0:URL.find("/")];

#isolate just the file, if it doesn't exist, make it blank
# file = URL[len(URL)-1];
# if len(URL) == 1:
# file = "";

# filename = domain + " > " + file;

#print "d= '" + domain + "'";
#print "f= '" + file + "'";
#-- Domain > File (end)
#--------

if options.datestamp:
import time
now = time.strftime("%Y%m%d")
# now = time.strftime("%Y%m%d%H%M%S")
filename = now + "-" + filename
# import os
# dir = os.path.abspath(os.path.expanduser(options.dir))
# return os.path.join(dir,filename)
return filename

#---------------------------------------------------
#8 - Saves the captured image(s) to the right place.

def saveImages(self,bitmapdata,filename,options):
# save the fullsize png
if options.fullsize:
bitmapdata.representationUsingType_properties_(AppKit.NSPNGFileType,None).writeToFile_atomically_(filename + "-full.png",objc.YES)

if options.thumb or options.clipped:
# work out how big the thumbnail is
width = bitmapdata.pixelsWide()
height = bitmapdata.pixelsHigh()
thumbWidth = (width * options.scale)
thumbHeight = (height * options.scale)

# make the thumbnails in a scratch image
scratch = AppKit.NSImage.alloc().initWithSize_(
Foundation.NSMakeSize(thumbWidth,thumbHeight))
scratch.lockFocus()
AppKit.NSGraphicsContext.currentContext().setImageInterpolation_(
AppKit.NSImageInterpolationHigh)
thumbRect = Foundation.NSMakeRect(0.0, 0.0, thumbWidth, thumbHeight)
clipRect = Foundation.NSMakeRect(0.0,
thumbHeight-options.clipheight,
options.clipwidth, options.clipheight)
bitmapdata.drawInRect_(thumbRect)
thumbOutput = AppKit.NSBitmapImageRep.alloc().initWithFocusedViewRect_(thumbRect)
clipOutput = AppKit.NSBitmapImageRep.alloc().initWithFocusedViewRect_(clipRect)
scratch.unlockFocus()

# save the thumbnails as pngs
if options.thumb:
thumbOutput.representationUsingType_properties_(
AppKit.NSPNGFileType,None
).writeToFile_atomically_(filename + ".png",objc.YES)
# thumbOutput.representationUsingType_properties_(
# AppKit.NSPNGFileType,None
# ).writeToFile_atomically_(filename + "-thumb.png",objc.YES)
if options.clipped:
clipOutput.representationUsingType_properties_(
AppKit.NSPNGFileType,None
).writeToFile_atomically_(filename + "-clipped.png",objc.YES)


Click here to read the complete article
1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor