limburgher / trelby

The free, multiplatform, feature-rich screenwriting program!

Home Page:http://www.trelby.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

doesnt work on ubuntu 20

ppbrown opened this issue · comments

thanks for the package...
now I can tell you it doesnt work on ubuntu 20 :-}
probably a python verison problem.

$ /usr/bin/python3 --version
Python 3.8.10

$ trelby
Traceback (most recent call last):
File "/usr/bin/trelby", line 9, in
import trelby
File "/usr/share/trelby/src/trelby.py", line 5, in
import cfgdlg
File "/usr/share/trelby/src/cfgdlg.py", line 1, in
import config
File "/usr/share/trelby/src/config.py", line 8, in
import screenplay
File "/usr/share/trelby/src/screenplay.py", line 48, in
class Screenplay:
File "/usr/share/trelby/src/screenplay.py", line 411, in Screenplay
def parseConfigLine(s: str)->tuple[str,str]:
TypeError: 'type' object is not subscriptable

If you clone the repo and just run ./bin/trelby, do you get the same error?

yup same error

Do you have an old ~/.trelby? Does Python3.9 work for you?

ah..
wel, yes I did have an old ~/.trelby. But I just renamed it and still get error.

if I apt-get install python3.9, i then get
ModuleNotFoundError: No module named 'wx._core'

That would mean you don't have wxPython installed for python 3.9. A virtualenv might be helpful here.

With the ~/.trelby moved aside, does it work with 3.8?

And python3-wxgtk4.0 is installed?

Hmm..
I'm thinking there may be some kind of proble since i have both python3.6 and python3.8 installed.
I did a clean up, and now seem to be getting different errors.
rather non-optimal though.

ah.
when I try python3.8 on teh PACKAGE I get the same errors.
However, when I try on the github tree i get

python3.8 bin/trelby
Traceback (most recent call last):
File "bin/trelby", line 9, in
import trelby
File "/trelby/src/trelby.py", line 123
os.mkdir(misc.toPath(misc.confPath), 0755)
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

and if i fix that, there's other problems.
So seems like you really rewrote the thing to require python 3.9

Wait... the github versions doesnt work with python3.9 either???
But the packaged version does..

I actually am trying to support alll versions above 3.7. The packaged version was built with 3.9 but I didn't think that made a difference. So the package works with 3.9?

it works with 3.9 venv.... ONLY after I go through a whole buncha hassle.
Some datapoints:

I had to reinstall ubuntu20.04 because I broke my ubuntu install tryin to get this to work :-/

Out of the box, default python is now python 3.8

it Does Not Work with the package. gives that tuple error.

TO get the 3.9 venv to work...
I had to MANUALLY download wxPython, and install the stuff in requirements.txt.
(edit: then install gcc g++ libgtk-3-dev libsdl2-dev libtiff-dev,
because it WONT USE system python3-wxgtk4.0
apparently because pip install wxpython defaults to using --gtk3)
(edit: plus install python3.9-dev)
(edit: then pip install wxpython)
Then ALSO manually install the packages mentioned in your readme, in your repo.

not nice.

would be nice if you also just included a requirements.txt.
Plus then also included it in the package somewhere.
presumably /usr/share/trelby/

except on my rebuilld.. I still cant get wxpython built so far. sigh..
i cant find a clear error yet.
even when trying to build wxpython by hand

Error building
ERROR: failed building wxWidgets
Traceback (most recent call last):
File "/home/pbrown/Downloads/wxPython-4.2.0/build.py", line 1563, in cmd_build_wx
wxbuild.main(wxDir(), build_options)
File "/home/pbrown/Downloads/wxPython-4.2.0/buildtools/build_wxwidgets.py", line 503, in main
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
File "/home/pbrown/Downloads/wxPython-4.2.0/buildtools/build_wxwidgets.py", line 72, in exitIfError
raise builder.BuildError(msg)
buildtools.builder.BuildError: Error building
Finished command: build_wx (0m8.72s)
Finished command: build (0m8.72s)

Oh. well, here's a surprise.
To get the venv for "python3.9"... I had to install full python 3.8 . ?? !!
apt install python3.8-full
apt install python3-pip

Then the python3.9 venv worked for your trelby, in ubuntu 20.04

There is a requirements.txt in the root of the git repo. It's not something that usually gets included in packages (at least not rpms or debs) because the package installation is supposed to pull in the required packages.

In this case the problem might be that the deb for 2.4.6 was built on Raspbian 11, and might therefore not be suitable for Ubuntu 20. I've been doing rpm packaging for ages but am less experienced with deb packaging. I'll try to create an Ubuntu 20 deb and see if it works better for you.

Thanks for the thought.
I'll be very interested to see how you make it work though, seeing as how normally the strength of .deb packages, is that they pull in dependancies. But there are not enough packages to pull in for dependancies here.
and running pip post package install is ugly.

I'm thinking you will have to package up an entire python3.9 venv environment for this.
For the record, my venv directory is around 650MB.
Not TOO horrendous, size wise,I suppose.

It shouldn't be that bad. :)

I think I tried to download from the place you said. but I dunno if it gave me the "right" one.
The one I ended up downloading:

$ cksum ./trelby_2.4.6_all.deb
3247655216 1525312 ./trelby_2.4.6_all.deb

btw: it didnt work. same error out of the box, about tuple.

Maybe you should give me an explicit direct url for the actual .deb you want me to download.
(ie: http://something/something.deb )

I've set one up and I can reproduce this. I'll check it out further.

Ok, I've narrowed this down to a Python 3.8 problem. @janopae, this looks like it was introduced here:

e276aa0

This breaks trelby for Python 3.8. Is there a way you can think of to do what you're aiming for that will preserve compatibility?

FYI my OBS build fro Ubuntu 22 works on Ubuntu 22.

Oh, sorry I broke that.

The part that seems to break this is not even related to what the commit tries to solve. I was a bit sloppy and committed the type information I added trying to understand the code along with the fix itlself, assuming adding type information would not do harm.

However, according to https://stackoverflow.com/questions/63460126/typeerror-type-object-is-not-subscriptable-in-a-function-signature, before Python 3.9, some builtin types seem to not allow using generic types with the brackets ([]) syntax, as this is interpreted as array access. That's why Python provides alternative definitions for these types, which support implement support for array access to allow this syntax. You can import these from the typing namepace.

The StackOverflow reply is about List, but I assume it's the same with tuple. I created PR #36 to fix it this way, but I haven't tested it yet.

No worries, we'll figure it out. Commented on the PR.