Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

Test gntp.notifier fails #58

Closed
sparkvilla opened this issue Mar 2, 2016 · 15 comments
Closed

Test gntp.notifier fails #58

sparkvilla opened this issue Mar 2, 2016 · 15 comments

Comments

@sparkvilla
Copy link

Hi, I installed gntp with pip on my machine running ubuntu 15.10. The installation looks ok, but when I type:

python -m gntp.notifier  #to check the installation

I get the following error:

INFO:__main__:Sending registration to localhost:23053
ERROR:__main__:Growl error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gntp/notifier.py", line 242, in mini
result = growl.register()
File "/usr/local/lib/python2.7/dist-packages/gntp/notifier.py", line 97, in register
return self._send('register', register)
File "/usr/local/lib/python2.7/dist-packages/gntp/notifier.py", line 204, in _send
raise errors.NetworkError(exc)
NetworkError: [Errno 111] Connection refused

Do you have an idea what is going on and how to fix it? Thank you

@kfdm
Copy link
Owner

kfdm commented Mar 2, 2016

I'm not certain about Growl on Linux but do you have a copy of Growl running?
I know there is a Growl for Linux project ( http://mattn.github.io/growl-for-linux/ ) but I have never used it so I do not know how well it is supported. I think most people who are using this library, are running it to send messages to the OSX Growl ( http://growl.info/ ) or Growl for Windows ( http://www.growlforwindows.com/gfw/ )

This library by itself does not create the messages on your desktop, but it talks to a Growl application to display those messages.

@sparkvilla
Copy link
Author

Actually I do not have a copy of Growl running. My first attempt to get growl notification was following the tutorial at http://masnun.com/2013/08/18/python-sending-growl-notifications.html. Do you think that having Grow installed is a prerequisite to make gntp work?

I would like to use growl notification triggered from my ubuntu localhost targeting a windows virtual machine.

@onionradish
Copy link

To send a Growl message to a different computer, you need to specify the hostname argument, which the default "run as module" quite reasonably does not do -- it tries to send to localhost, so if you don't have a local Growl client running, it will fail.

I've tested sending Growl messages going the other way (sending a message from Linux virtual machine to Windows host), and it works:

import gntp.notifier
import logging

# enable display of debug messages
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)-10s - %(message)s')

# send a test (use IP address or hostname)
gntp.notifier.mini('foo', hostname="192.168.1.3")  # target host IP address

The Windows growl settings under the Security tab need to have "Allow network notifications" on, and if the "require password" options are enabled, a password needs to be assigned in the growl "password manager", and password must be passed as a parameter in addition to hostname.

@kfdm
Copy link
Owner

kfdm commented Mar 3, 2016

I think onionradish covered most of it. The default "run as a module" is meant as a simple check to see if it's installed correctly, but perhaps I should make the error messages more clear and add a bit of a better note in the documentation.

This library ships with a "gntp" command that you can use to send a message and check to see if it is hitting your VM correctly.
gntp -m test -H 127.0.0.1 -P password

@sparkvilla
Copy link
Author

@onionradish and @kfdm Thank you for your support, that helps. However I am still fighting to make it work. I guess the problem is I am not able to install growl on my windows VM, i.e. when I run the GrowlInstaller.exe it asks me for .NET version 2.0.50727 which is weird because .NET is already installed on my VM. Thus, if I try to run the example suggested by @onionradish at first seems to work but then I get a growl error:

2016-03-03 09:15:15,839 - INFO       - Sending registration to 192.168.122.123:23053
2016-03-03 09:15:15,844 - DEBUG      - To : 192.168.122.123:23053 <<class   'gntp.core.GNTPRegister'>>
GNTP/1.0 REGISTER NONE
Application-Name: PythonMini
Origin-Platform-Version: Linux-4.2.0-30-generic-x86_64-with-Ubuntu-15.10-wily
Origin-Software-Version: 1.0.2
Origin-Machine-Name: HP-EliteBook-Folio-9470m
Origin-Software-Name: gntp.py
Origin-Platform-Name: Linux
Notifications-Count: 1
Notification-Enabled: True
Notification-Name: Message

2016-03-03 09:15:18,847 - ERROR      - Growl error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gntp/notifier.py", line 242, in mini
result = growl.register()
File "/usr/local/lib/python2.7/dist-packages/gntp/notifier.py", line 97, in register
return self._send('register', register)
File "/usr/local/lib/python2.7/dist-packages/gntp/notifier.py", line 204, in _send
raise errors.NetworkError(exc)
NetworkError: timed out

@sparkvilla
Copy link
Author

So I managed to install Growl on windows10 VM. The .NET required was problematic because I had updates disabled. After re-enable them I could install .NET and Growl.

Now, I get a growl icon on my desktop and if I click on it a desktop message shows up saying: "Growl is running". However no Growl Screen appears...Is this normal? Is there another way I can access the Growl screen in order to "Allow network notifications" and "password" options? I will keep trying

@fraxen
Copy link

fraxen commented Mar 3, 2016

You should address these questions to the GfW Google group - make sure that Growl for windows is running as it should first! https://groups.google.com/forum/#!forum/growl-for-windows

(try double-click on the Growl icon in the try to get settings, and then test it using the installed growlnotify tool on the windows machine... !)

@sparkvilla
Copy link
Author

I navigate to the folder GrowlforWindows in my cmd and then run the growlnotify.exe. After that I can write messages that appear on my desktop. So the growlnotify works. I addressed my original question the GrowlGooglegroup.

@kfdm
Copy link
Owner

kfdm commented Mar 3, 2016

If you have Growl working on your Windows VM, then I suppose the next step is to make sure you can send a message from Linux. Make sure the Windows firewall is allowing messages on the Growl port (default is 23053) and that Growl is listening.

@sparkvilla
Copy link
Author

I managed to send desktop notification from my linux host through Ansible executing a Powershell script. But when using python I have again an error:

gntp.error.NetworkError: [Errno 104] Connection reset by peer

I changed the advanced setting for the Windows Firewall allowing port 23053 to be opened but that does not improve the situation. The main problem is that I cannot access to the Growl Screen where I can change the settings. For example I would like also to set Growl to start automatically when I log into Windows VM but I am unable to do that. Is there an alternative way to change settings (so that I can follow the tutorial at http://www.growlforwindows.com/gfw/help/#notifications) when you do not have access to Growl Screen?

@kfdm
Copy link
Owner

kfdm commented Mar 7, 2016

You may be able to manipulate the growl settings directly
/Users//AppData/Local/Growl/2.0.0.0/user.config I think

Something like this

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="userSettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </configSections>
    <userSettings>
        <setting name="AutoStart" serializeAs="String">
            <value>True</value>
        </setting>
        <setting name="AllowNetworkNotifications" serializeAs="String">
            <value>True</value>
        </setting>
    </userSettings>
</configuration>

@sparkvilla
Copy link
Author

On my windows 10 VM the file you are referring to is called Growl.exe.config and it is under C:\Program Files (x86)\Growl for Windows/`. I edited this file and changed to true the values:

Autostart = True
AllowNetworkNotification = True
EnableLoggin = True

I restarted the VM but I still need to click on Growl icon to start growl, and still gntp from linux host does not work...something else to change that you are aware of?

@kfdm
Copy link
Owner

kfdm commented Mar 7, 2016

I'm not sure. At this point you may need to wait for a response on the GfW forum. I don't use Windows as my primary environment (and I'm still running Win7) so I'm not aware of all the nuances of Windows 10.

@sparkvilla
Copy link
Author

Thanks for your help..

@kfdm
Copy link
Owner

kfdm commented Mar 7, 2016

If it's alright with you, I'm going to close this ticket for now while you wait to hear back from the GfW forum. If they get back to you and think it's a problem with this library, please feel free to re-open this thread :)

@kfdm kfdm closed this as completed Mar 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants