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

Standalone version? #198

Closed
jaylex32 opened this issue Nov 7, 2022 · 7 comments
Closed

Standalone version? #198

jaylex32 opened this issue Nov 7, 2022 · 7 comments

Comments

@jaylex32
Copy link

jaylex32 commented Nov 7, 2022

Is there a way I can run mnamer standalone without installing from pip? I would like to wrapped in a .exe so I don’t have to depend on python environment. Is that possible? Thanks in advance.

@jojo141185
Copy link

You can try to generate an executable e.g. via PyInstaller.

@jaylex32
Copy link
Author

jaylex32 commented Nov 9, 2022

You can try to generate an executable e.g. via PyInstaller.

That’s not working unfortunately, thanks for the help!

@gelven4sec
Copy link

Python is an interpreted language that depends on the Python interpreter.

Pyinstaller is the closest thing you can get for a standalone version.

@jaylex32
Copy link
Author

Python is an interpreted language that depends on the Python interpreter.

Pyinstaller is the closest thing you can get for a standalone version.

Yes I understand and I try to build it but it won’t work, I don’t know if is because it needs a lot of dependencies or maybe I just don’t know how to build it, I did and when I run it gives errors and won’t work. Have you build it before?

@gelven4sec
Copy link

Yes I understand and I try to build it but it won’t work, I don’t know if is because it needs a lot of dependencies or maybe I just don’t know how to build it, I did and when I run it gives errors and won’t work. Have you build it before?

Could you paste the error message here ? I may be able to help you.

There's actually another standalone version, by using a Docker container.

@Radiotechniman
Copy link

Just tried the docker container, it also crashed

`Starting mnamer

Processing Episode "The.Rookie.S05E09.WEBRip.x264-ION10.mp4" (410.75MB)

============================== CRASH REPORT BEGIN ==============================

--------------------------------- environment ----------------------------------

  • date = 2022-12-07
  • platform = Linux-5.10.60-qnap-x86_64-with
  • arguments = ['--batch', '/mnt']
  • cache location = /root/.cache/mnamer-py3.9.sql
  • python version = 3.9.9
  • mnamer version = 2.5.2
  • appdirs version = 1.4.4
  • babelfish version = 0.5.5-dev
  • guessit version = 3.2.0
  • requests version = 2.26.0
  • requests cache version = 0.5.2
  • teletype version = 1.1.0

--------------------------------- stack trace ----------------------------------

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/mnamer/main.py", line 23, in main
frontend.launch()
File "/usr/local/lib/python3.9/site-packages/mnamer/frontends.py", line 80, in launch
self._process_targets()
File "/usr/local/lib/python3.9/site-packages/mnamer/frontends.py", line 97, in _process_targets
matches = target.query()
File "/usr/local/lib/python3.9/site-packages/mnamer/target.py", line 233, in query
for idx, result in enumerate(results, start=1):
File "/usr/local/lib/python3.9/site-packages/mnamer/providers.py", line 374, in search
yield from self._search_with_season_and_episode(
File "/usr/local/lib/python3.9/site-packages/mnamer/providers.py", line 437, in _search_with_season_and_episode
series_data = tvmaze_show_search(series)
File "/usr/local/lib/python3.9/site-packages/mnamer/endpoints.py", line 466, in tvmaze_show_search
status, content = request_json(url, parameters, cache=cache)
File "/usr/local/lib/python3.9/site-packages/mnamer/utils.py", line 264, in request_json
session = get_session()
File "/usr/local/lib/python3.9/site-packages/mnamer/utils.py", line 188, in get_session
get_session.session = requests_cache.CachedSession(
File "/usr/local/lib/python3.9/site-packages/requests_cache/core.py", line 73, in init
self.cache = backends.create_backend(backend, cache_name, backend_options)
File "/usr/local/lib/python3.9/site-packages/requests_cache/backends/init.py", line 63, in create_backend
return registry[backend_name](cache_name, **options)
File "/usr/local/lib/python3.9/site-packages/requests_cache/backends/sqlite.py", line 28, in init
self.responses = DbPickleDict(location + extension, 'responses', fast_save=fast_save)
File "/usr/local/lib/python3.9/site-packages/requests_cache/backends/storage/dbdict.py", line 62, in init
with self.connection() as con:
File "/usr/local/lib/python3.9/contextlib.py", line 119, in enter
return next(self.gen)
File "/usr/local/lib/python3.9/site-packages/requests_cache/backends/storage/dbdict.py", line 74, in connection
con = sqlite.connect(self.filename)
sqlite3.OperationalError: unable to open database file

=============================== CRASH REPORT END ===============================

Dang, it looks like mnamer crashed! Please consider filling an issue at
https://github.com/jkwill87/mnamer/issues along with this report.
`

@jkwill87
Copy link
Owner

A proper standalone version isn't in the works. The reason mnamer is implemented in Python as opposed to languages which can be compiled and statically linked, e.g. Go, Rust, c++, etc., is ease of development. As mentioned, there are creative ways to bundle single file executables, e.g. using Nukita, PyInstaller, PyOxidizer, etc., but they are all a maintenance and publishing pain which undermine ease of development.

I'll look into the docker issue. It's intended to "just work" without any tweaking. Your issue seems attributable to a write permission error when writing to the network cache database. In the meantime, this could likely be fixed by creating a volume or mount for /root/.cache/, or just disabling caching altogether through a config file.

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

No branches or pull requests

5 participants