Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8613669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:56:20+00:00 2026-06-12T04:56:20+00:00

I have put together a simple time difference python script with whatever I know

  • 0

I have put together a simple time difference python script with whatever I know and it works fine with Python 2.7.3. The script finds the time difference and then sends a desktop notification in Ubuntu using python-notify.

$ cat timediff.py 
import sys
import pynotify
import datetime

now = datetime.datetime.now().replace(microsecond=0)
then = datetime.datetime(2012,11,5,8,0,0)

diff = then - now

hours = (diff.seconds) / 3600
minutes = (diff.seconds - hours * 3600) / 60
seconds = (diff.seconds  - (hours * 3600 + minutes * 60))

def sendmessage(title, message):
    pynotify.init("image")
    notice = pynotify.Notification(title,message,"/usr/share/icons/gnome/48x48/status/important.png").show()
    return notice
sendmessage("Time remaining to exam","%s days, %s hours, %s minutes and %s seconds."% (diff.days,hours,minutes,seconds))

However, it seems to fail if I run it with Python 3.2.3. It seems like there is no python-notify module for Python 3.2.

$ python3.2 timediff.py 
Traceback (most recent call last):
  File "timediff.py", line 2, in <module>
    import pynotify
ImportError: No module named pynotify

Is it possible to use python-notify with Python3 somehow or am I going to have to stick with Python 2.7 until the bindings are ported for Python 3.2?

I found a mailing list dated April 2010 which suggests that pynotify may not be Python3 compatible. Has there been improvements on that regard at least?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:56:21+00:00Added an answer on June 12, 2026 at 4:56 am

    I haven’t tried it, but here is a pynotify replacement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I put together a simple script that pulls the product name, category name and
I have put together a simple ASP.NET MVC 3 test web app that uses
Trying to do a simple web app with jquery mobile. I have put together
I have put together this simple code for showing/hiding some content on click using
I have a simple accordion menu I've put together today using the jQuery slideDown()
I have put together a script to delete backed up files, but believe I
I have put together a script which is very much like the flickr photostream
I have put together a navigation bar which expands a submenu on hover. See
I have put together a .net winform application which consumes a wcf service exposed
I have put together an API that responds to a POST request by putting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.