Python Installed; bash command: python base.py. gets syntax error in base.py
Python is installed
Apparently it's pyGTK2 ( it's 2.6.5 according to Synaptic Package Manager. this is what shows on the bash terminal (trying to keep the main directory uncluttered hence the webdev-pp directoy; it's my main workspace) Code:
gregory@gregory-laptop:~/webdev-pp$ cd python-pp5 this is the script Code:
1 #!/usr/bin/env python and it works fine but think it must be something to do with the installation and if it is a systems wide installation or not but am not sure what to try next. Thank you in advance for any input you care to give. I am very new to Linux and computer languages since late last year though some experience with PHP and MySQL from earlier last year and some Javascript during Multimedia studies while getting my Graphic design diploma. Its very new to me and just back from a long break on Holiday but what I have learned is coming back to me. I would appreciate your help very much. |
The problem is with the line numbers in the file. You need to get rid of them and then it will work
|
thanks I had to take the indents of of the lines as well and now it works
I do appreciate that python seems to need all the spacings to be right before it will interpret the script so that seems to be a big part of the language. thanks pgpython |
That is correct, indentation is how python delimits blocks instead of braces. I don't mind this to be honest as good code should have good indentation anyway. The only thing you have to be careful of is if you mix tabs and spaces. The way to avoid this common problem is to set your editor up correctly. use a standard of 4 spaces of tabs and you should be fine
|
cre84j, Solved? Please mark it so. TIA.
|
All times are GMT -5. The time now is 06:15 AM. |