DebugConsole on Ubuntu 22.04

For discussion of ports to POSIX based systems, especially using GNUStep.

Moderators: another_commander, winston, Getafix

Post Reply
Gwydion
Average
Average
Posts: 10
Joined: Wed Oct 18, 2023 4:41 pm

DebugConsole on Ubuntu 22.04

Post by Gwydion »

Hi, First thank you to everyone who makes Oolite possible, even if you make the tea. :mrgreen:

I'm new so about me: I was a programmer/developer/software engineer writing my first code (basic and assembler) on an Acorn Atom in 1981.
I played the BBC version then Commodore 64 version when they first came out. I wrote Elite Cheat for the CBM64 to mangle the saved files on floppy disk.
I have played Oolite for many year off and on, but now I have the time to hopefully add something to it. I decided to play around with some oxp development and therefore was looking at the dev version 1.90-test.

I'm in Ubuntu Linux (22.04), 4 core AMD 3.80Ghz, NVIDIA GeForce RTX 2070, 32GB RAM and TBs of free spinning rust. Using Logitec rumble pad. Oolite runs very well.

So what I've read and tried so far. Downloaded and installed the dev version oolite-1.90-test.linux-x86_64.run. Only problem was it overwrites where the non-dev version goes. Tried the switch "--target NewDirectory Extract in NewDirectory" but that seemed to be ignored. Oh well, not to worry.

Found the link for Debug.oxp got that installed in AddOns. https://wiki.alioth.net/index.php/Debug_OXP that page also led to https://wiki.alioth.net/index.php/Oolit ... P_protocol.

Installed the modules for: blt python-tk tk8.6 (tk8.5 is no longer available on Ubuntu)
Downloaded OoDebugConsole1.6.zip from https://github.com/OoliteProject/oolite ... e/releases and the extracted the DebugConsole.zip (python version) into the Aplications/DebugConsole. As it seemed like a good place to put it.

When trying to execute DebugConsle.py it had Windows CRLF endings so I converted those to Linux newlines.

I received this error:
File "~GNUstep/Applications/DebugConsole/DebugConsole.py", line 438
app.listener=reactor.listenTCP(tryPort, factory)
^
IndentationError: expected an indented block


Removed that install as I saw there was a git repo so I cloned that into Applications/oolite-debug-console, reconverted the line endings.

Hmm same error. Seems that "try/except" block got messed up with the CRLF convert and save. (I think the original file had <TAB>s in the code aaahh!)

Then I needed twisted 😀️. Got that with apt install python3-twisted and get the same error as it twisted is not found.

Traceback (most recent call last):
File "~/GNUstep/Applications/oolite-debug-console/DebugConsole.py", line 20, in <module>
from ooliteConsoleServer import *
File "~/GNUstep/Applications/oolite-debug-console/ooliteConsoleServer/__init__.py", line 18, in <module>
raise ImportError("ooliteConsoleServer requires Twisted (http://twistedmatrix.com/)")
ImportError: ooliteConsoleServer requires Twisted (http://twistedmatrix.com/)



I did find a thread here viewtopic.php?f=9&t=4862 by DaddyHoggy and answered by JensAyton. With some bullet points to follow. Basically what I have already done.

I lost track of where I went from there but it seemed like a rabbit hole. I found a few sites on installing twisted and it's dependencies with pip. Tried those out too.

I need a little help as I cannot see a solution to get the console running. I have found nothing on the BB or wiki but may well have missed something as the documentation is extensive. If I've missed one or more web pages please point me at them.

Thanks for reading this far.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16055
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: DebugConsole on Ubuntu 22.04

Post by Cody »

Welcome aboard, Commander! Hopefully, a penguinista will be along shortly to help.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
Alnivel
Dangerous
Dangerous
Posts: 100
Joined: Fri Jun 10, 2022 7:05 pm

Re: DebugConsole on Ubuntu 22.04

Post by Alnivel »

Which version of Python are you using? You installed the package for 3rd version, but the console is written in 2nd.
Have you tried to use python2 instead of just python and installing dependencies via pip2?
User avatar
hiran
Theorethicist
Posts: 2027
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: DebugConsole on Ubuntu 22.04

Post by hiran »

Alnivel wrote: Wed Oct 18, 2023 8:11 pm
Which version of Python are you using? You installed the package for 3rd version, but the console is written in 2nd.
Have you tried to use python2 instead of just python and installing dependencies via pip2?
Indeed, good catch. I'm not into Python, but my Ubuntu installation gives these results:

Code: Select all

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
$ python --version
Python 3.10.12
$ 
BUT: Python 2 has run out of support quite some time ago. If we have someone with Python knowledge it might be worth to migrate the console.
https://www.python.org/downloads/release/python-2718/
Sunshine - Moonlight - Good Times - Oolite
User avatar
Cholmondely
Archivist
Archivist
Posts: 4977
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: DebugConsole on Ubuntu 22.04

Post by Cholmondely »

Gwydion wrote: Wed Oct 18, 2023 7:33 pm
...even if you make the tea.
Welcome to our merry "throng"!
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Gwydion
Average
Average
Posts: 10
Joined: Wed Oct 18, 2023 4:41 pm

Re: DebugConsole on Ubuntu 22.04 [solved]

Post by Gwydion »

Thank you for the warm welcome.

I have python 2.7.18 installed according to python --version. BUT, DOH!! I installed pip for python 3 and therefore had twisted for python 3.

A few hoops jumped through and now the console is working!

Thank you everyone for your help and good catch on spotting the version.
User avatar
MrFlibble
Deadly
Deadly
Posts: 166
Joined: Sun Feb 18, 2024 12:13 pm

Re: DebugConsole on Ubuntu 22.04

Post by MrFlibble »

I'm on LinuxMint 21.3, where the system python 2.7 is very lame indeed (as it has become on most systems now I guess).

I worked around it using pyenv thus:-

(Note: this all assumes you're not already using pyenv. If you are, then cherry pick for clues)

Code: Select all

#Installing these so newly built python 2.7.18 will have all it can.
apt install tk-dev libreadline-dev libbz2-dev libssl-dev libsqlite3-dev git

#Now locally install pyenv
curl https://pyenv.run | bash
At this point, add the relevant bits to .profile and .bashrc as prompted by pyenv installer

Added to $HOME/.bashrc and $HOME/.profile

Code: Select all

export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Exit and then start a fresh shell to continue.

Code: Select all

#set up a virtual environment for our Debug
pyenv install 2.7.18 # This will take a while.
pyenv virtualenv 2.7.18 Oolite-Debug
pyenv activate Oolite-Debug
pip install twisted
exit
Then I copied the DebugConsole directory from the zip into $HOME/.pyenv/versions/Oolite-Debug.

To launch manually from a terminal we can use:

Code: Select all

pyenv activate Oolite-Debug
cd $HOME/.pyenv/versions/2.7.18/envs/Oolite-Debug/DebugConsole
python DebugConsole.py
Note: Changing directory so the config files written by the debugger end up in the right place.

I use a script to launch it thus:

Code: Select all

#!/bin/bash
source $HOME/.pyenv/versions/Oolite-Debug/bin/activate
cd $HOME/.pyenv/versions/2.7.18/envs/Oolite-Debug/DebugConsole && python ./DebugConsole.py
Note that "pyenv activate" doesn't play nice in a bash script, so we activate by sourcing.
Post Reply