I have never used Python before, and unfortunately, this makes me completely ignorant. For this I apologise.
I have a Dell Dell Latitude D430 laptop running Mint Katya
I am attempting to start up a python script which is used to program 4 servos. I have python 2.7.1-0 as supplied by the Ubuntu Synaptic package manager . I also installed tk 8.5.9-2 and python tkinter 2.7-2Ubuntu2 and python-serial 2.5-2 all via Synaptic.
I then downloaded 3 python scripts called servoset.py, colours.py and servo4config into my /home/alistair/JMRI/servoset directory and attempted to run it from a terminal in the Mint GUI.
The error report was:
./JMRI/servoset.py: line 6: $'\nmodule\documentation\nservoset.py\nthis is a small sample of text\n': command not found
At this point I found that the cursor changed to yellow crosshairs, so something worked.
I then tried running without the GUI and got:
import: Unable to open X server `' @ error/Import.c/ImportImageCommand/362.
This line repeated 11 more times.
Then the lines:
./JMRI/servoset.py: line 20: syntax error near unexpected token `'/home/alistair/JMRI/servoset/colours'
./JMRI/servoset.py: line 20: `syspath append ('/home/alistair/JMRI/servoset/colours')
I also get several postscript files appearing in my home directory, namely:
logging.ps,math.ps,codecs.ps gtk.ps and serial.ps
The first 30 odd lines of servoset is:
# -*- coding: utf-8 -*-
'''
module documentation
servoset.py
this is a small sample of text
'''
import Tkinter as GTK
import codecs
import logging
import math
import os.path
import serial
import sys
import time
import tkFileDialog
import tkFont
import tkMessageBox
import types
sys.path.append('/home/alistair/JMRI/servoset/colours')
import colours as Colour
# sys.getfilesystemencoding() = UTF-8
# sys.argv = ['servoset.py', '-q', 'that', 'this']
# the current list of exceptions... for ease of spelling
#
# BaseException
## +-- SystemExit
## +-- KeyboardInterrupt
## +-- GeneratorExit
# +-- Exception
## +-- StopIteration
I take it python doesn't like "this is a small sample of text"
I'm told that everything else that is required in the import lines are already bundled with Python. Is this true?
The colours.py is as follows:
# -*- coding: utf-8 -*-
AZURE = '#F0FFFF'
GOLD = '#FFD700'
GREEN = '#008000'
LIGHTBLUE = '#ADD8E6'
ORANGE = '#FFA500'
TOMATO = '#FF6347'
WHITESMOKE = '#F5F5F5'
YELLOW = '#FFFF00'
Should this have an extension of .py or not?
The same question for servo4config.
# MERG Servo Board Programmer: Library data
# (C) J F Hamilton 2010
# Written by version: development, dated: 2010/12/10 10:08:10
# Written at 10:11 on 2010/12/10
# Contact john@hamilton.org.uk M3201
#
servo|90|12|SG-90|TowerPro 9g miniature anticlockwise
#
board|SRV4E|3201-ac|Second servo board
channel|J2|SG-90
channel|J2|Open|0|0|33|22|11
channel|J2|Closed|255|1|222|233|244
channel|J3|SG-90
channel|J3|Open|100|1|33|22|11
channel|J3|Closed|150|0|222|233|244
channel|J4|SG-90
channel|J4|Open|200|2|33|22|11
channel|J4|Closed|50|2|222|233|244
channel|J5|SG-90
channel|J5|Open|0|1|33|22|11
channel|J5|Closed|255|0|222|233|244
#
# end of file
If I rem out lines 1 to 6 of servoset, then on the gui I get the crosshair and nothing else. Without the gui I get exectly the same errors except the first one, is that because it expects to be run in the gui? if so, then it's just the syntax of line 20 I have to sort out, and the fact that I get nothing but a yellow cursor...
Thanks in anticipation..
Fitch