Python Forum
[split] SyntaxError: invalid syntax - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: [split] SyntaxError: invalid syntax (/thread-33552.html)



[split] SyntaxError: invalid syntax - Code_X - May-04-2021

Hello,
I am sorry if this forum is closed but I have a similar issue where my code is telling me this:

Error:
Traceback (most recent call last): File "program.py", line 4, in <module> import moon as m File "/home/pi/moon.py", line 8 of the moon for a given date; and phase_hunt(), which given a date, finds the dates of the nearest full moon, new moon, etc. """ from math import sin, cos, floor, sqrt, pi, tan, atan # asin, atan2 ^ SyntaxError: invalid syntax
why is this? code can be provided. I must also mention that I am writing this on a raspberry pi zero running rasbpian lite.


RE: Syntax error not understood - Larz60+ - May-04-2021

you need to install the 'moon' package
you should be able to install with pip3 install moon (if allowed on Pi)


RE: Syntax error not understood - bowlofred - May-04-2021

You your file /home/pi/moon.py is being found instead of the moon module. Don't use the same name for a file and a module. Rename your moon.py to something different.


RE: Syntax error not understood - Yoriz - May-04-2021

You have
from math import sin, cos, floor, sqrt, pi, tan, atan # asin, atan2
on the end of a docstring line
of the moon for a given date; and phase_hunt(), which given a date, finds the dates of the nearest full moon, new moon, etc. """
move it onto a line of its own.