You are Here:
Linux Lite 4.2 Beta has been released. See the Release Announcements Section.




displaying a monthly calendar

Author (Read 461 times)

0 Members and 1 Guest are viewing this topic.

displaying a monthly calendar
« on: July 10, 2018, 09:21:01 AM »
 

colin

  • Occasional Poster
  • **
  • 54
    Posts
  • Country: wales
  • Reputation: 4
  • Linux Lite Member

  • Linux Lite: 3.8 64bit
I came across a Python 3 tutorial for displaying a monthly calendar and it worked a treat from the command-line but for some reason it would not work after i added the Python shebang
Code: [Select]
#!/usr/bin/env python 3.6.Instead it would produce a load of errors. Have since been informed that i had to change the file name from calendar.py to my_calendar.py and once again it worked a treat.
Still cannot work it out why the program didn't work because 'calendar' is not a reserved word? 
Old and getting even older lol
 


Re: displaying a monthly calendar
« Reply #1 on: July 10, 2018, 09:33:29 AM »
 

DeepThought

  • Occasional Poster
  • **
  • 71
    Posts
  • Country: wales
  • Reputation: 13
  • Linux Lite Member
    • WKDfm Radio | WKDfm Chat

  • Linux Lite: 3.8 64bit

  • CPU: AMD Turion(tm) 64 x 2 Mobile Technology TL-60

  • MEMORY: 4Gb

  • VIDEO CARD: ATI RS480
Python has a module called calendar.py so you can't use the same name for your own script :)

[EDIT] A list of Python modules can be found here:

https://docs.python.org/3/py-modindex.html#cap-c
Last Edit: July 10, 2018, 09:45:18 AM by DeepThought
Owner and DJ at WKDfm Radio ( www.wkdfm.co.uk )
 

Re: displaying a monthly calendar
« Reply #2 on: July 10, 2018, 12:04:19 PM »
 

colin

  • Occasional Poster
  • **
  • 54
    Posts
  • Country: wales
  • Reputation: 4
  • Linux Lite Member

  • Linux Lite: 3.8 64bit
Should have thought that it was a module because i did check the Python reserved word list but didn't think of checking Python modules. Big thanks for the help DeepThought it really was appreciated.
Old and getting even older lol
 

Re: displaying a monthly calendar
« Reply #3 on: July 10, 2018, 12:07:10 PM »
 

DeepThought

  • Occasional Poster
  • **
  • 71
    Posts
  • Country: wales
  • Reputation: 13
  • Linux Lite Member
    • WKDfm Radio | WKDfm Chat

  • Linux Lite: 3.8 64bit

  • CPU: AMD Turion(tm) 64 x 2 Mobile Technology TL-60

  • MEMORY: 4Gb

  • VIDEO CARD: ATI RS480
No probs :)

A little tip when writing your own scripts, add my or even your own initials to a script, avoids conflicts with default scripts already in place. So my-calendar.py or in my case dt-calendar.py should be ok :)
Last Edit: July 10, 2018, 12:12:41 PM by DeepThought
Owner and DJ at WKDfm Radio ( www.wkdfm.co.uk )
 

Re: displaying a monthly calendar
« Reply #4 on: July 11, 2018, 07:55:15 AM »
 

colin

  • Occasional Poster
  • **
  • 54
    Posts
  • Country: wales
  • Reputation: 4
  • Linux Lite Member

  • Linux Lite: 3.8 64bit
Hello once again DeepThought
I shall definitely take onboard your suggestion using initials on scripts to avoid conflicts.Big thanks
 
Old and getting even older lol
 


Tags:
 


Linux Lite 4.2 Beta has been released. See the Release Announcements Section.