rmrl icon indicating copy to clipboard operation
rmrl copied to clipboard

Python 3.6

Open qwert2003 opened this issue 3 years ago • 5 comments

Is there a way to compile the program with Python 3.6? OpenSUSE Leap (current 15.2 and upcoming 15.3) stays at 3.6.12.

qwert2003 avatar Apr 12 '21 20:04 qwert2003

Have you tried running it under 3.6? I don't think there's anything explicitly 3.7ish about the code. The newest feature used are f-strings, which were introduced in 3.6 if I remember correctly.

Sorry for the delay in responding. (Life, you know.)

rschroll avatar May 30 '21 19:05 rschroll

Yes, it actually runs under Python 3.6. But to get there is not straight forward. And I could not compile a binary (executable file that i could put into ~/bin). The problem is, that the required version somewhere is set to 3.7. Could it be set to 3.6 (as 3.7 is not required)?

I can run it using the command python3 -m rmrl notebook.zip > out.pdf

qwert2003 avatar Jun 01 '21 22:06 qwert2003

I'm afraid I'm not following what you're trying to do. Running rmrl with the python -m line is the recommended approach. It's a library, not an executable, and it's Python, so it doesn't get compiled into machine code. If you really want something in ~/bin, why not make a single-line shell script?

python3 -m rmrl "$@"

I'm hesitant to downgrade the Python version since I'm developing in 3.7 and don't yet have a CI test suite to run it under 3.6. It's entirely possible that a 3.7ism will sneak in in the future, and I'd rather that people on 3.6 be aware of the risk of future breakage than be surprised by it. (Also, 3.6 has only 6 months until EOL, so developing new software for it at this point seems like a bit of a waste.)

If there's something that's absolutely broken right now, let me know. But from what I understand, everything seems to be working as designed for you.

rschroll avatar Jun 04 '21 07:06 rschroll

I am looking for a command line tool to convert rm files to pdf. Not being a python programmer the library functionality is out of scope. Basically I'd like to be able to run rmrl notebook.zip > out.pdf. Optionally I would like to create an rpm for OpenSUSE.

why not make a single-line shell script? python3 -m rmrl "$@"

The command only runs if I first cd into the directory above rmrl (I have ~/extract/rmrl, thus I must cd ~/extract/). If I run python3 -m rmrl notebook.zip > out.pdf from any other directory, I'll get an error message /usr/bin/python3: No module named rmrl.__main__; 'rmrl' is a package and cannot be directly executed. If I run ´python3 -m ~/extract/rmrl notebook.zip > out.pdf´from any other directory, I'll get an error message /usr/bin/python3: No module named /home/user/extract/rmrl

Thus a single-line shell script as proposed does not work in my case.

But from what I understand, everything seems to be working as designed for you.

The work-around (running rmrl from that exact directory) works. But to get there on OpenSUSE it takes a lot of patience. pip install rmrl will not work. I had to run that command multiple times, read the error message to see what dependency is missing (pip cannot install it, probably due to the 3.7 requirement). Then install that dependency from elsewhere. The last run pip install --user rmrl (when all the dependencies are fulfilled) will quit with the message

ERROR: Could not find a version that satisfies the requirement rmrl (from versions: none)
ERROR: No matching distribution found for rmrl

Not sure how to procede. By the way, the current versions of RCU (which seems to be the origin of rmrl) do compile on OpenSUSE.

qwert2003 avatar Jun 04 '21 09:06 qwert2003

It sounds to me like you could solve your problem either by setting your $PYTHONPATH to include where you downloaded rmcl, or by passing the --python-version flag to pip (https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-python-version).

But if I can get some sort of smoke test running on 3.6, I'll see about adjusting the dependency.

rschroll avatar Jun 12 '21 07:06 rschroll