Linux Lite Forums
displaying a monthly calendar - Printable Version

+- Linux Lite Forums (https://www.freecinema2022.gq/forums)
+-- Forum: Development (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=7)
+--- Forum: Coding (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=33)
+--- Thread: displaying a monthly calendar (/showthread.php?tid=5464)



displaying a monthly calendar - colin - 07-10-2018

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:
#!/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? 


Re: displaying a monthly calendar - DeepThought - 07-10-2018

Python has a module called calendar.py so you can't use the same name for your own script Smile

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

https://docs.python.org/3/py-modindex.html#cap-c


Re: displaying a monthly calendar - colin - 07-10-2018

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.


Re: displaying a monthly calendar - DeepThought - 07-10-2018

No probs Smile

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 Smile


Re: displaying a monthly calendar - colin - 07-11-2018

Hello once again DeepThought
I shall definitely take onboard your suggestion using initials on scripts to avoid conflicts.Big thanks