NaitLee / Cat-Printer

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

Error "TypeError: expected str, bytes or os.PathLike object, not NoneType" on command line. #58

Closed nodlek-ctrl closed 1 year ago

nodlek-ctrl commented 1 year ago

Command executed-

image

Output-

image

I have tried-

Most likely me doing something wrong, so some help would be fantastic.

NaitLee commented 1 year ago

Likely the system doesn’t have ImageMagick installed.

I guess this is a Raspberry Pi, try to install it:

sudo apt install imagemagick

Then retry.

I think the code should give a clear solution for such case. I hereby leave a todo :)

P.S. Usually, energy efficiency is desired on a device like Raspberry Pi, so you may want to use PF2 font instead. See #11. (and #10 for some info, #29 for a real case. You don’t need ImageMagick for this.)

nodlek-ctrl commented 1 year ago

Thanks. I installed magick and now I get this error. image

Right now, energy efficiency isn't a concern as I am not using batteries. Thanks for the tip however. Edit; Just read your last few words. Ill have a go at PF2.

nodlek-ctrl commented 1 year ago

Hell yeah! PF2 works a charm! Tanks again. I might have to take a look at that todo list and get some of the easy ones done for you!

NaitLee commented 1 year ago

IMHO Debian/Ubuntu always have outdated packages served (they call it “stable” 🙂), in your case it’s IM 6 but there’s already IM 7 a long time ago.

IM have some “policy” thing that controls what kind of thing could be converted or not, for security. It’s an XML config. Likely the default config doesn’t allow you to convert (either) from text (or) to PBM format (or both).

I forgot where it is and how to properly change it. The Internet may tell you more.

Congrats for solving your problem 🎉

NaitLee commented 1 year ago

I think this problem is a good point to start. If you can do Python, I have some idea —

Code relative to telling ImageMagick is here.

But it returns None if not found, thus the initial problem happened.

We could make it more friendly to:

And more of it:

I think I should include a small PF2 font in next releases, just in case.

nodlek-ctrl commented 1 year ago

Alright! I can do python, I just usually struggle understanding larger scripts. Now that you've pointed out the important bit, I should be able to whip up a pull request sometime in the next week.

Good on you for helping people out! ⭐