Green-Recorder "SyntaxError: invalid syntax" when executing the binary, python 2.7, Fedora 32
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Green-Recorder "SyntaxError: invalid syntax" when executing the binary, python 2.7, Fedora 32
I get this output when executing the green-recorder binary
Code:
[james@localhost green-recorder-master]$ ./green-recorder
File "./green-recorder", line 74
print "You are recording on: " + str(DisplayServer)
^
SyntaxError: invalid syntax
So my first thought was there's a syntax error 'cause it says it right there. I don't know python at all so I'd have no hope of fixing it myself, and I can't find any complaints about it with the project so it's probably correct and something else is the problem.
This isn't a big priority for me so I ain't gonna spend days figuring out python, I'm hoping someone with time to burn who does know python can help me out with this, if not, eh.
Oh yea, I do have the python27 package installed for python 2 support.
Oh yea, I do have the python27 package installed for python 2 support.
It looks like green-recorder is written in Python2, but the interpreter you use is Python3. In Python3, print is a regular function and requires parentheses.
You installed Python2, but I guess you are still using Python 3 as the default interpreter. Right now, I see two options:
modify green-recorder to use Python2. You do this by writing the path to the Python2 executable after a "#!" (known as "hash-bang") in the first line of the program.
Create a symbolic link from Python2 to /usr/bin/python. You need to be aware that this affects all other Python programs. It's probably not the best solution.
It looks like green-recorder is written in Python2, but the interpreter you use is Python3. In Python3, print is a regular function and requires parentheses.
You installed Python2, but I guess you are still using Python 3 as the default interpreter. Right now, I see two options:
modify green-recorder to use Python2. You do this by writing the path to the Python2 executable after a "#!" (known as "hash-bang") in the first line of the program.
Create a symbolic link from Python2 to /usr/bin/python. You need to be aware that this affects all other Python programs. It's probably not the best solution.
The current "hash-bang" is #!/usr/bin/python, I changed that to #!/usr/bin/python2.7 after making sure that /usr/bin/python2.7 exists. (I also tried #!/usr/bin/python2, same results)
This time I'm getting
Code:
[james@localhost green-recorder-master]$ ./green-recorder
Traceback (most recent call last):
File "./green-recorder", line 17, in <module>
import gi
ImportError: No module named gi
What I can figure out from that gi error is the gi module is missing. A little looking up and I think it's related to pygobject2, I found it in the repos and installed it, green recorder still won't launch. A whereis couldn't find pygobject2, pygobject, gobject, or gi, so I'm not really sure what the binaries for it are named but I'm pretty sure it installed correctly.
The package python2-gobject was dropped from Fedora 32. From the changelog:
Quote:
2020-01-16 - Miro Hrončok <mhroncok@redhat.com> - 3.34.0-4
- Subpackages python2-gobject, python2-gobject-base, python2-gobject-devel have been removed
See https://fedoraproject.org/wiki/Changes/RetirePython2
Your options are:
install via pip2 from PyPI
rebuild from Fedora 31 source
The same applies to python2-pydbus which is also required by Green Recorder.
But the best option, IMO, would be to find another screen recording application. From Green Recorder's README:
Quote:
This project is archived, it's no longer under development. As the original developer, the work of maintaining and updating this program takes too much of my time, which I was giving for free, and I am no longer interested in working with things like ffmpeg/wayland/GNOME's screencaster or solving the issues related to them or why they don't work. If you would like to continue development, please feel free to fork the project according to the GPL license.
But the best option, IMO, would be to find another screen recording application.
I would love to find another screen recorder application that's full native Wayland. The closed I could find is OBS with it's X11/Wayland plug-in, but OBS locks up when I give it permission to view my screen. I'm open to suggestions, I was contemplating between making a thread to see if I could fix Green Recorder and making a thread to look for Wayland screen recorders. My last thread about Wayland didn't do so well so I decided to make this one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.