th3-z / kf2-magicked-admin

:spider: Mutator-free management, statistics, and in-game bot for ranked Killing Floor 2 servers
https://kf2-ma.th3-z.xyz
MIT License
32 stars 7 forks source link

Error on initial run from 0.1.6 linux release version related to text encoding #168

Open mokahless opened 4 years ago

mokahless commented 4 years ago

Reproduce (0.1.6 on ubuntu server 20.0.4 LTS running python3 3.8.2): -install all requirements -run python3 -O magicked_admin/magicked_admin

error/result: File "magicked_admin/magicked_admin", line 1 SyntaxError: Non-UTF-8 code starting with '\x88' in file magicked_admin/magicked_admin on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Additional, minor issues I ran into while trying to set this up: -requirements.txt is not included in the linux releases and needs to be downloaded manually from the source -instructions say to run magicked_admin.py but (at least in the linux release) it does not have a file extension -I tried the git cloning method instead but "git clone git@github.com:th3-z/kf2-magicked-admin.git" results in git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Eventually, I ended up building from source. This was confusing as no instructions were given beyond the requirements. I threw in a "make" command in the folder and it seemed to do it, throwing all the needed files into magicked_admin. Although there were many various errors during make, none interrupted the process and it seems to be working.

th3-z commented 4 years ago

run python3 -O magicked_admin/magicked_admin

You're missing a .py extension there.

requirements.txt is not included in the linux releases and needs to be downloaded manually from the source

It's a binary, you don't need it.

instructions say to run magicked_admin.py but (at least in the linux release) it does not have a file extension

It says that in the "Running from Python sources" section. That file is part of the source code. It's not in the binary, you just run the binary like would any other executable.

File "magicked_admin/magicked_admin", line 1 SyntaxError: Non-UTF-8 code starting with '\x88' in file magicked_admin/magicked_admin on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

the file magicked_admin/magicked-admin is not a Python file, it's a binary.

Permission denied (publickey). fatal: Could not read from remote repository.

I've updated this section.

This was confusing as no instructions were given beyond the requirements

From the readme "You can build a binary release for distribution with make after installing both the run and build requirements". I'm not sure what else you expect, all you need to do is run make to produce a build.

mokahless commented 4 years ago

Thanks for the response. Sounds like it's all on my end rather than any real bugs.

You're missing a .py extension there. requirements.txt is not included in the linux releases and needs to be downloaded manually from the source It's a binary, you don't need it. instructions say to run magicked_admin.py but (at least in the linux release) it does not have a file extension It says that in the "Running from Python sources" section. That file is part of the source code. It's not in the binary, you just run the binary like would any other executable.

The reason I'm using magicked_admin/magicked-admin is because magicked_admin/magicked-admin.py does not exist in the release I downloaded. https://github.com/th3-z/kf2-magicked-admin/releases/download/0.1.6/kf2-magicked-admin-0.1.6-linux.tar.gz. From what you are saying, it's not supposed to and I am supposed to run the binary. That was my initial thought and I ran into errors there so I thought I was messing up doing that haha.

I initially tried to run the binary file there as a binary file and got errors. I'll try to fetch the exact error later and post it as before but essentially it complained about UTF-8 as soon as it tried to list the second language on initial run but also listed several tracebacks. This is when I started thinking it was maybe a mislabeled .py file. Once I post it, if it's a real error, I should probably post a new bug report.

I'm not sure what else you expect, all you need to do is run make to produce a build.

Most people don't know what make even is. I recommend just adding "run make blah blah" to build in the instructions or something. Other times I have had to "build" and "make." It's all pretty foreign to me.

th3-z commented 4 years ago

Yeah, the readme needs some work, I'll review it at some point. Feel free to raise a PR if you want to contribute to it.

The issue is you're trying to run the binary with Python, it's an ELF. you can just run it with a command like ./bin/magicked_admin/magicked_admin.

I just ran make on my Ubuntu machine and it only gave me a handful of advisory warnings, no errors. I'm already aware of them and they aren't an issue. I am working on removing the make requirement in favour of Python's setuputils to make it easier to build on other platforms but I've never had issue with make on Linux.

mokahless commented 4 years ago

Here's the error I initially got when attempting to run the binary on my system setup (back when I wasn't confusing it with a python script).

./magicked_admin/magicked_admin

[*] No configuration was found, first time setup is required!
    Please input your web admin details below.

        1: English (en_GB)
Traceback (most recent call last):
  File "/home/the_z/.local/lib/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
  File "/home/the_z/.local/lib/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
  File "magicked_admin/magicked_admin.py", line 207, in <module>
  File "magicked_admin/magicked_admin.py", line 72, in __init__
  File "/media/data/prog/kf2-magicked-admin/magicked_admin/settings.py", line 67, in __init__
  File "/media/data/prog/kf2-magicked-admin/magicked_admin/settings.py", line 148, in construct_config_interactive
UnicodeEncodeError: 'ascii' codec can't encode character '\xf1' in position 8: ordinal not in range(128)

I initially started my post with this error but then thought maybe it was something I was doing and that's how I ended up trying to run it as a python script haha.

I just ran make on my Ubuntu machine and it only gave me a handful of advisory warnings, no errors. In that case it is very likely I was misconstruing warnings for errors during make. I didn't take note of them since the final result worked perfectly.

Anyway, thanks a bunch for making this awesome tool! It honestly does the kind of stuff I've been wanting to automate for years in an easy interface and scripting style.

th3-z commented 4 years ago

Can you paste the output of echo $LANG, it looks like your locale isn't setup right to display unicode, Python is trying to output in ascii rather than utf-8 (should be detected if supported). A solution might be something like export LANG=en_GB.UTF-8.