GrowlNotify 1.3 + Growl 1.3.1 for Lion: error - growl

I'm working on Mac OS X 10.7.2 with Growl 1.3.1 for Lion. I installed
growlnotify version 1.3 and executed growlnotify -a Emacs.app -m "foo"
in the terminal. I obtain:
2011-12-11 11:26:39.349 growlnotify[86152:707] <GrowlGNTPRegistrationAttempt: 0x7fa202017f00> failed because Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo=0x7fa202202450 {NSLocalizedDescription=Socket closed by remote peer}
2011-12-11 11:26:39.351 growlnotify[86152:707] Failed to register with (null)
Afterwards, growl disappears from the menu bar. In other words: It crashed.
Has anyone experienced something similar?
It's most likely not an emacs problem, I also get this if I choose other applications.

I know this may not apply specifically to OS X 10.7.2 but I came to this answer looking for a way to Growel in the latest (currently Yosemite 10.10.5) and found this other answer that works in Mavericks+ and was exactly what I was looking for:
With Mavericks and later, you can do this using AppleScript's 'display notification':
display notification "Lorem ipsum dolor sit amet" with title "Title"
AppleScript can be run from the shell using /usr/bin/osascript:
osascript -e 'display notification "Lorem ipsum dolor sit amet" with title "Title"'
There are a lot more details in How can I trigger a Notification Center notification from an AppleScript or shell script?

Try setting a password in your Growl network settings and specify the password via the -P option.
Apparently it's a known bug: http://metacpan.org/pod/Net::Growl#Internal-OO-API-only

Related

Problem with destroy in tkinter under Anaconda Spyder

In the following program, I can close the window with its close button but neither with the 'Esc' binding, nor the button callback. I am sent to the IPython console but the window stays here with a spinning wheel ! Works fine in the Terminal or with Anaconda IDLE. I am on Mac, High Sierra, Anaconda and Spyder last versions (IPython 7.1.1, Spyder 3.3.2). I suspect a problem with Spyder.
from tkinter import *
class Myapp(object):
def __init__(self):
self.root = Tk()
self.root.geometry('150x100+1+1')
self.root.title('Root')
self.root.bind('<Escape>', lambda e: self.root.destroy())
self.button = Button(self.root, text='End Program', command=self.end)
self.button.place(x=10, y=45)
self.L = [1,2,3] # result of an omitted computation
def end(self):
self.root.destroy()
app = Myapp()
app.root.mainloop()
print(app.L)
Any hint ? Thanks.
(Spyder maintainer here) You have two options to make your code work in Spyder:
Go to
Tools > Preferences > IPython console > Graphics
and deactivate the option called Activate support. Then after running your code, it'll block the console, but you won't have any other problems with it.
If you selected Tk as the backend in
Tools > Preferences > IPython console > Graphics
then you need to remove app.root.mainloop() from your code because using our Preferences creates a Tk event loop so your code doesn't block the console, and that makes app.root.mainloop() unnecessary.
Destroy doesn't work in spyder for me either, but does work fine from the system's Terminal. Carlos Cordoba's advice doesn't help.
I'm on a Mac OS Mojave, with most recent versions of Anaconda Python and Spyder available for Mojave.
I would post this as a comment, but don't have the reputation to do that.

Previously successful Scapy installation for Python 3, sniff() now failing with AttributeError

On Mac OS 10.13.1
Using Scapy for the first time to do a simple packet-sniffing project.
Was working perfectly fine over the weekend after following the installation instructions here for Mac OS:
https://phaethon.github.io/scapy/api/installation.html
Hardware problems required me to move my work to a different machine, running the exact same OS.
I figured "no problem" - setup a new Python 3 venv and reinstalled dependencies on the second laptop (libdnet via brew, libpcap and scapy3k via pip).
Now a simple test using sniff() in Scapy produces the following error:
Traceback (most recent call last):
File "", line 1, in
File "/Users/ersheff/Virtualenvs/Scapy/lib/python3.6/site->packages/scapy/sendrecv.py", line 576, in sniff
s = L2socket(type=ETH_P_ALL, *arg, **karg)
File "/Users/ersheff/Virtualenvs/Scapy/lib/python3.6/site->packages/scapy/arch/linux.py", line 469, in init
self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, >socket.htons(type))
AttributeError: module 'socket' has no attribute 'AF_PACKET'
I'm well aware that the AF_PACKET attribute is not available on Mac OS and is specific to Linux, and as you might expect, all of my searching about this problem leads to that answer. However, as mentioned, this method was working for me before on a different machine with the same OS.
Admittedly, I'm a novice, but reading that error makes it look to me like Scapy is erroneously referring to the linux.py file in the arch directory when it should be referring to the bsd.py or unix.py files (both of which are present).
Any ideas?
Thanks in advance.
This question is old. For the record, the official scapy version now supports Python 3. OSX has been fixed on their sides:
https://github.com/secdev/scapy
Have a nice week,

Error when trying to run Swift from terminal

After entering
~ sudo xcode-select -switch /Applications/Xcode6-Beta3.app/Contents/Developer
and then
~ xcrun swift
I get an error
ImportError: No module named site
Assertion failed: (err == 0), function ~Mutex, file /SourceCache/lldb/lldb-320.4.106.2/source/Host/common/Mutex.cpp, line 246.
Abort trap: 6
What am I missing? Several tutorials online give this code, so I'm guessing it must be some sort of setup issue.
I had a similar error and resolved it by removing the entry to my 3rd-party Python distribution (Enthought Canopy, in my case) from the PATH environment variable. This was a manual hack in my Terminal session and is good for only that session but it was as simple as this:
~ [1]$ swift
ImportError: No module named site
~ [2]$ echo $PATH
/Users/tdiller/Library/Enthought/Canopy_64bit/User/bin:/usr/local/git/bin:~/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/local/texlive/2012/bin/universal-darwin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/go/bin
~ [3]$ PATH=PATH=/usr/local/git/bin:~/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/local/texlive/2012/bin/universal-darwin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/go/bin
~ [4]$ export PATH
~ [5]$ swift
Welcome to Swift version 1.2. Type :help for assistance.
1>
I'm not sure what in Canopy-64bit/User/bin/ intereferes with Swift, but removing that item on the path seems to do the trick if you want to use the Swift REPL. There doesn't seem to be a problem with the EPD-style entry (/Library/Frameworks/Python.framework...).
Of course, Canopy won't work from this Terminal session, but I'm not sure it's important to have Python REPL and Swift REPL working in the same session.
It should be
$ xcode-select -switch /Applications/Xcode6-Beta3.app/Contents/Developer
See this article for more 1. Learn Swift by running Scripts

How can I use swift in Terminal?

I read What's new in Xcode 6. The article introduces some new feature about Xcode 6, and it says:
Command Line
Xcode’s debugger includes an interactive version of the Swift language, known as the REPL (Read-Eval-Print-Loop). Use Swift syntax to evaluate and interact with your running app or write new code in a script-like environment. The REPL is available from within LLDB in Xcode’s console, or from Terminal.
I want to know how to get the REPL?
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
then you can do one of these:
xcrun swift
lldb --repl
As of Xcode 6.1 - typing swift in the terminal launches the REPL as well.
Alternatively, if you don't want to mess up your current dev environment, you can just run:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
Step 1: Open Terminal
Step 2: Type "swift"
Step 3: There's no step 3
Example:
GoldCoast:~ macmark$ swift
Welcome to Swift! Type :help for assistance.
1> println("Hello, world")
Hello, world
2> var myVariable = 42
myVariable: Int = 42
3> myVariable = 50
4> let myConstant = 42
myConstant: Int = 42
5> println(myVariable)
50
6> let label = "The width is "
label: String = "The width is "
7> let width = 94
width: Int = 94
8> let widthLabel = label + String(width)
widthLabel: String = "The width is 94"
9> :exit
GoldCoast:~ macmark$
In Xcode 6.1.1 with Command Line Tools installed you can execute scripts by referencing directly to /usr/bin/swift the following way:
#!/usr/bin/swift
let variable: String = "string"
print("Test \(variable)")
In the same fashion as running Swift from the Terminal, you can also execute scripts.
Just use the following shebang, and run your script. (As per Chris Lattner, creator of Swift)
#!/usr/bin/env xcrun swift -i
If any one cares a simple Swift script shebang:
#!/usr/bin/env xcrun --sdk macosx swift
If specific target version is required
#!/usr/bin/env xcrun --sdk macosx swift -target x86_64-macosx10.11
If specific toolchain is required (like you want to use Swift 2.3 but you are using Xcode 8)
#!/usr/bin/env xcrun --toolchain com.apple.dt.toolchain.Swift_2_3 --sdk macosx swift -target x86_64-macosx10.11
If you want to use Swift 2.2 in your Xcode 7.3.1, let's assume Xcode 7.3.1 is located at /Applications/Xcode7.app
sudo xcode-select -s /Applications/Xcode7.app/
xcrun --sdk macosx swift
from now on the default active developer directory changed, you can check that using:
xcode-select -p
If you want to use snapshots provided by Swift.org, you should not miss Installation here.
as first answered by me in Run swift script from Xcode iOS project as build phase
** update as of xcode6 beta 4 **
this can also be done on xcode preferences. simply go to xcode -> preferences -> locations.
for command line tools simply select the version you want from drop down list options, refer picture below. (swift requires path to be xcode6's path).
I will leave my previous answer below as well.
what Kaan said and you can also use an apple script to make simple application so you can use it to switch back and forth.
open apple script > paste this below code & export it as an application so with just one click you can switch to default path or beta path (to use swift)
set xcode6Path to "xcode-select -switch /Applications/Xcode6-Beta.app/Contents/Developer"
set xcodeDefaultPath to "xcode-select -switch /Applications/Xcode.app/Contents/Developer"
display dialog "set xcode sdk path to " buttons {"xcode 6", "default"} default button 1
copy result as list to {buttonPressed}
if buttonPressed is "default" then
try
do shell script xcodeDefaultPath with administrator privileges
end try
else
try
do shell script xcode6Path with administrator privileges
end try
end if
then run > xcrun swift
disclaimer
the script assumes you have both xcode6-beta & xcode5 installed.
if you're a new developer who's trying out only xcode6beta you will not need any script or setting path manually. simply run xcrun swift as the path is already set for you.
when xcode6 is finally released you will need to reset your path back to default from this simple app and never use it again.
After installing the official Xcode 6.1 release, there is a swift command in /usr/bin/swift.
Bear in mind that if you have a Python different from the Apple-supplied Python in the path, swift can fail with ImportError: No module named site. In that case, make sure that you do export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin before calling swift.
The xcrun command will use the DEVELOPER_DIR environment variable to override the currently selected Xcode installation (as set with xcode-select). You can use that to construct a single command that'll run swift on the command line and put you in the REPL. That looks like this:
/usr/bin/env DEVELOPER_DIR=/Applications/Xcode6-Beta.app/Contents/Developer xcrun swift
and you can alias that to just 'swift':
alias swift="/usr/bin/env DEVELOPER_DIR=/Applications/Xcode6-Beta.app/Contents/Developer xcrun swift"
As an interesting side note, you can use the same kind of invocation to run a swift script just like you'd use bash or python by adding a -i:
#!/usr/bin/env DEVELOPER_DIR=/Applications/Xcode6-Beta.app/Contents/Developer xcrun swift -i
println("Hello World!")
Of course, once Xcode 6 is released officially and you switch to that as your default developer tools, you can drop the DEVELOPER_DIR=.. bits and just use "xcrun swift".
make sure you install xcode 6.0 ,but not 6.1
If you get an error:
<unknown>:0: error: the SDK 'MacOSX10.9.sdk' does not support Swift
just run
xcrun --sdk iphonesimulator8.0 swift
or you can
export SDKROOT="iphonesimulator8.0"
and then
xcrun swift
Use "xcodebuild -showsdks" to list the available SDK names.
if you install xcode 6.1,just
sudo xcode-select -s /Applications/*your-Xcode-6.1-path.app*/Contents/Developer
xcrun swift
For XCode6, run these commands:
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
$ xcrun swift
If you get an error:
<unknown>:0: error: the SDK 'MacOSX10.9.sdk' does not support Swift
try:
xcrun swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
open Terminal,
$sudo xcode-select -switch /Applications/Xcode6-Beta6.app/Contents/Developer
Notice: The Xcode6-Beta6.app should be replaced to appropriate version you installed
Then put this line alias swift='xcrun swift' to ~/.bash_profile
And,
$source ~/.bash_profile
$swift
There you go!
With the help of Swift REPL(Read Eval Print Loop).
Developers familiar with interpreted languages will feel comfortable in this command-line environment, and even experienced developers will find a few unique features
Launch Terminal.app and type swift and press enter. You’ll then be in the Swift REPL.
1> print("Hello Swift REPL")
Hello Swift REPL
2> 10 + 20
$R0: Int = 30
3> var name = "Yogendra Singh"
name: String = "Yogendra Singh"
4> print(name)
Yogendra Singh
5>

Does Mac X11 have the XTEST extension?

So I moved some X programs down to the mac, and I'm getting
Error: XTEST extension unavailable on '(null)'.
from xdotool.
Does OS X X11 come with XTEST?
If not, is there a way to add it?
Run the following command in the Terminal:
defaults write org.x.X11 enable_test_extensions -boolean true
(as per here). Then quit and restart the X server; the XTEST extension should then be available.
I had to do the following two commands to get this to work on Mountain Lion (from here):
defaults write org.x.X11 enable_test_extensions -boolean true
defaults write org.macosforge.xquartz.X11 enable_test_extensions -boolean true
For XQuartz,
defaults write org.macosforge.xquartz.X11 enable_test_extensions -bool yes
See this link.
Mac has test extension as part of the open source XQuartz project (if installed).
The X11.app was available by default for Mac OS X v10.5-10.7, but since Mountain Lion, Apple dropped dedicated support for X11.app, with users directed to the open source XQuartz project (to which it contributes) instead.
To test if the TEST extension is enabled, try the following commands:
$ defaults read org.x.X11
{
"enable_test_extensions" = 1;
}
$ defaults read org.macosforge.xquartz.X11
{
...
"enable_test_extensions" = 1;
"startx_script" = "/opt/X11/bin/startx -- /opt/X11/bin/Xquartz";
}
For downloading instructions, check XQuartz page.

Resources