NaitLee / Cat-Printer

Application supporting Bluetooth thermal “Cat Printers”, for everyone!
GNU General Public License v3.0
307 stars 31 forks source link

Cant open main.py and (or just) server.py #56

Open Eduardfabian21 opened 1 year ago

Eduardfabian21 commented 1 year ago

When ever i try to open it says this imagine_2023-03-14_144327303 Im using: Windows 10 Home version 22H2 Latest version of Python Latest version of Cat Printer

Eduardfabian21 commented 1 year ago
AndCouvel commented 1 year ago

same here

NaitLee commented 1 year ago

Are you sure it’s the latest version of Python? Try python3 --version to see the interpreter version.

By the way, try if this snippet will work:

a = 10
while a := a - 1:
    print(a)

The := operator is added in Python 3.8, it should be earlier versions showing a Syntax Error.

Eduardfabian21 commented 1 year ago

To my surprize, it outputed: Python 3.7.9

NaitLee commented 1 year ago

As far as I can remember, on Windows, typical command to invoke Python is py.

I don’t know about old versions, probably an old version was kept for python3 in your case (and probably by something else.)

Eduardfabian21 commented 1 year ago

I tryed with 3.10.10 and it says: Traceback (most recent call last): File "C:\Users\Edi\Downloads\cat-printer-pure-0.6.2.0\cat-printer\main.py", line 3, in <module> from server import serve File "C:\Users\Edi\Downloads\cat-printer-pure-0.6.2.0\cat-printer\server.py", line 22, in <module> from printer import PrinterDriver, PrinterError, i18n, info File "C:\Users\Edi\Downloads\cat-printer-pure-0.6.2.0\cat-printer\printer.py", line 78, in <module> raise error File "C:\Users\Edi\Downloads\cat-printer-pure-0.6.2.0\cat-printer\printer.py", line 74, in <module> from bleak import BleakClient, BleakScanner File "C:\Users\Edi\Downloads\cat-printer-pure-0.6.2.0\cat-printer\bleak\__init__.py", line 73, in <module> from bleak.backends.winrt.scanner import ( File "C:\Users\Edi\Downloads\cat-printer-pure-0.6.2.0\cat-printer\bleak\backends\winrt\scanner.py", line 6, in <module> from bleak_winrt.windows.devices.bluetooth.advertisement import ( ModuleNotFoundError: No module named 'bleak_winrt'

Eduardfabian21 commented 1 year ago

And on windows you can still use python3 cmd EVEN if its a newer version

Eduardfabian21 commented 1 year ago

If i use py main.py, it opens a new windows

Eduardfabian21 commented 1 year ago

and i forgot to say that, windows forces me to download it from the windows store

NaitLee commented 1 year ago

You may install Python dependencies with pip. Cat-Printer is using bleak (along with bleak_winrt, on Windows.)

pip install bleak

It’s a pity that I’m unable to setup a good Windows bundle in a long time.

NaitLee commented 1 year ago

btw main.py is unimportant, it’s just a helper script for Android and does nothing special other than “executing” server.py by importing.

AndCouvel commented 1 year ago

I have Python 3.11.2 🥲El 14 mar 2023, a la(s) 7:09 p.m., NaitLee @.***> escribió: Are you sure it’s the latest version of Python? Try python3 --version to see the interpreter version. By the way, try if this snippet will work: a = 10 while a := a - 1: print(a) The := operator is added in Python 3.8, it should be earlier versions showing a Syntax Error.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

AndCouvel commented 1 year ago

The snippet doesn’t run 😭And my Python is updated Enviado desde mi iPhoneEl 14 mar 2023, a la(s) 7:09 p.m., NaitLee @.***> escribió: Are you sure it’s the latest version of Python? Try python3 --version to see the interpreter version. By the way, try if this snippet will work: a = 10 while a := a - 1: print(a) The := operator is added in Python 3.8, it should be earlier versions showing a Syntax Error.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

Eduardfabian21 commented 1 year ago

It outputed:

Requirement already satisfied: bleak in c:\users\edi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (0.19.5) Requirement already satisfied: bleak-winrt<2.0.0,>=1.2.0 in c:\users\edi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from bleak) (1.2.0) Requirement already satisfied: async-timeout<5,>=3.0.0 in c:\users\edi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from bleak) (4.0.2)

Eduardfabian21 commented 1 year ago

I also saw that you still need python for the older ver of cat-printer imagine_2023-03-15_212612500

NaitLee commented 1 year ago

Seems the pure bundle have outdated dependency.

You may want the bare bundle, or simply clone the repository.

That batch script is intended for a complete Windows bundle (available for some earlier versions), where an embeddable Python 3 is included (and that’s named python.exe, hence python)

NaitLee commented 1 year ago

Hi @AndCouvel, I didn’t see Python 3.11.2 problems here. You may send some snapshots to show what’s exactly going on your side :)

AndCouvel commented 1 year ago

Hi @AndCouvel, I didn’t see Python 3.11.2 problems here. You may send some snapshots to show what’s exactly going on your side :)

andrescouvel@Macbook-Air-de-Andy cat-printer % python3 server.py Traceback (most recent call last): File "/Users/andrescouvel/Downloads/cat-printer/server.py", line 22, in from printer import PrinterDriver, PrinterError, i18n, info File "/Users/andrescouvel/Downloads/cat-printer/printer.py", line 48, in i18n = I18nLib(path).translate ^^^^^^^^^^^^^ File "/Users/andrescouvel/Downloads/cat-printer/printerlib/i18n.py", line 23, in init self.lang = lang or (locale.getdefaultlocale()[0] or fallback).replace('', '-') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'replace' andrescouvel@Macbook-Air-de-Andy cat-printer %

that is the error code, running on Macbook Air M1

NaitLee commented 10 months ago

In case technology is a problem, just use this new Web app: https://print.unseen-site.fun/

Be sure to use a Chromium-based browser for it. Safari is probably ok too.