Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error GT06ScannerClient.py #6

Open
mavmala opened this issue May 12, 2022 · 10 comments
Open

error GT06ScannerClient.py #6

mavmala opened this issue May 12, 2022 · 10 comments

Comments

@mavmala
Copy link

mavmala commented May 12, 2022

Hello,

I am trying to make this work, I can start the python venv but if i run the runClient.py i get the following error:

File "runClient.py", line 3, in
import GT06ScannerClient
File "/home/ubilinux/GT06ScannerClient/GT06ScannerClient.py", line 9, in
import gt06Client
File "/home/ubilinux/GT06ScannerClient/gt06Client.py", line 47
logging.exception(f"Cannot connect to {self.serverAddress}:{self.serverPort}")

I edited the confix.xml to use my server and portnr, but I have no idea how to continue

any help?
TIA

@lmandres
Copy link
Owner

Hi @mavmala . Does it work if you use the demo.traccar.org address that comes default in the config.xml file?

@mavmala
Copy link
Author

mavmala commented May 12, 2022

Hi, thanks for answering!

No it gives errors as well.although different ones:

Hello from the pygame community. https://www.pygame.org/contribute.html
Namespace(config='config.xml', gps_baud=None, gps_port=None, id=None, magnification=None, maps_url=None, server_address=None, server_port=None, update_delay=None, zoom=None)
Traceback (most recent call last):
File "runClient.py", line 78, in
mapsMagnificationIn=args.magnification
File "/home/ubilinux/GT06ScannerClient/GT06ScannerClient.py", line 36, in init
self.configReader = configReader.ConfigReader(configFile)
File "/home/ubilinux/GT06ScannerClient/configReader.py", line 12, in init
self.configXML = ElementTree.parse(fileName)
File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 1195, in parse
tree.parse(source, parser)
File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 596, in parse
self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0

@lmandres
Copy link
Owner

lmandres commented May 12, 2022

Hi @mavmala . This is telling me that the XML in the last message has an error in it. Can you verify that the XML validates properly? You can use the following online validator:

https://www.w3schools.com/xml/xml_validator.asp

@mavmala
Copy link
Author

mavmala commented May 12, 2022

This is the message I get:

XML Parsing Error: mismatched tag. Expected: .
Location: https://www.w3schools.com/xml/xml_validator.asp
Line Number 5, Column 20:
Reminder
-------------------^

@lmandres
Copy link
Owner

lmandres commented May 12, 2022

Yeah. If the XML is the same, that's the Hostname line. You can try copy and pasting the demo tag to make sure that it's correct:

<Hostname>demo.traccar.org</Hostname>

You'll need to make sure the case on the tags are the same.

@mavmala
Copy link
Author

mavmala commented May 12, 2022

copy & pasted it, still the same error:

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Namespace(config='config.xml', gps_baud=None, gps_port=None, id=None, magnification=None, maps_url=None, server_address=None, server_port=None, update_delay=None, zoom=None)
Traceback (most recent call last):
File "runClient.py", line 78, in
mapsMagnificationIn=args.magnification
File "/home/ubilinux/GT06ScannerClient/GT06ScannerClient.py", line 36, in init
self.configReader = configReader.ConfigReader(configFile)
File "/home/ubilinux/GT06ScannerClient/configReader.py", line 12, in init
self.configXML = ElementTree.parse(fileName)
File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 1195, in parse
tree.parse(source, parser)
File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 596, in parse
self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0

@mavmala
Copy link
Author

mavmala commented May 12, 2022

downloaded the config.xml again, and now it gives another error

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Namespace(config='config.xml', gps_baud=None, gps_port=None, id=None, magnification=None, maps_url=None, server_address=None, server_port=None, update_delay=None, zoom=None)
ERROR:root:ScannerID is expected to be HEX value
Traceback (most recent call last):
File "/home/ubilinux/GT06ScannerClient/configReader.py", line 25, in getScannerID
bytes.fromhex(scannerID)
ValueError: non-hexadecimal number found in fromhex() arg at position 4

@lmandres
Copy link
Owner

lmandres commented May 12, 2022

In the XML file, check this line:

<ScannerIDNumber>0123456789012345</ScannerIDNumber>

There should only be numerical digits (0-9) or hex digits (a-f). Other characters would make it fail.

@mavmala
Copy link
Author

mavmala commented May 13, 2022

Got it fixed, it works now with a remote traccar server

have not tested it yet but will it run on a headless device?

@lmandres
Copy link
Owner

It will run on headless, but you have to have a way to start up the script on boot. I haven't put together instructions for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants