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

oledterm #120

Open
peterbmckinley opened this issue Aug 3, 2020 · 19 comments
Open

oledterm #120

peterbmckinley opened this issue Aug 3, 2020 · 19 comments
Labels

Comments

@peterbmckinley
Copy link

My setup:
Orange Pi Zero
Armbian Buster
1.3" OLED on i2c bus, SH1106 controller

I have all the luma.examples running fine (with the exception of the Raspberry Pi camera specific ones) and I'm intrigued by the idea of piping console to my OLED display. I came across this cool project:

https://github.com/satoshinm/oledterm

But when I run:

python3 oledterm.py --i2c-port 0 --display sh1106

I get:

File "oledterm.py", line 55
print "Unable to access %s, try running as root?" % (VIRTUAL_TERMINAL_DEVICE,)
^
SyntaxError: invalid syntax

I opened an issue on the oledterm project, but I don't think it's actively maintained. I think oledterm would be a killer example to be considered for possible inclusion in luma.examples, but any tips why it's not working for me?

Peter

@rm-hull
Copy link
Owner

rm-hull commented Aug 4, 2020

huh, interesting project !

It looks as though the project was written for python2, and you are invoking it with the python3 runtime.

print  "Unable to access %s, try running as root?" % (VIRTUAL_TERMINAL_DEVICE,)

is the old python2 way of printing that is not supported on python3, it should be:

print("Unable to access %s, try running as root?" % (VIRTUAL_TERMINAL_DEVICE,))

You should be able to use the 2to3 command (bundled with python) to convert it. See: https://docs.python.org/3/library/2to3.html

@peterbmckinley
Copy link
Author

peterbmckinley commented Aug 4, 2020 via email

@peterbmckinley
Copy link
Author

peterbmckinley commented Aug 4, 2020 via email

@peterbmckinley
Copy link
Author

peterbmckinley commented Aug 4, 2020 via email

@thijstriemstra
Copy link
Collaborator

bring it into the 21st century Python3 world, test it and consider adding it to your list of examples?

Including it in the repository would require permission from the author.

@peterbmckinley
Copy link
Author

peterbmckinley commented Aug 4, 2020 via email

@peterbmckinley
Copy link
Author

Oops sorry thijstriemstra!

@peterbmckinley
Copy link
Author

peterbmckinley commented Aug 4, 2020

Ok I ran the script through 2to3 with writeback option, now when I run:

python3 oledterm.py --i2c-port 0 --display sh1106

I get:

Traceback (most recent call last):
  File "oledterm.py", line 113, in <module>
    main()
  File "oledterm.py", line 100, in main
    term.putch(char)
  File "/usr/local/lib/python3.7/dist-packages/luma/core/virtual.py", line 327, in putch
    w = self.font.getsize(char)[0]
  File "/usr/local/lib/python3.7/dist-packages/PIL/ImageFont.py", line 262, in getsize
    size, offset = self.font.getsize(text, False, direction, features, language)
TypeError: expected string

I realise this is an unfair question for here, but since oledterm uses luma.oled you guys are my only hope!

Peter

@peterbmckinley
Copy link
Author

Hi all! Are we admitting defeat on this?

@rm-hull
Copy link
Owner

rm-hull commented Aug 10, 2020

I'll have a go at a clean-room re-implementation of what is in that repo, directly in luma.examples

@peterbmckinley
Copy link
Author

peterbmckinley commented Aug 10, 2020 via email

@peterbmckinley
Copy link
Author

Hi just wondered if satoshinm's script looks viable? I have no clue how his spell works, if it ever did........

@peterbmckinley
Copy link
Author

peterbmckinley commented Aug 24, 2020

Krizzel87 has had some success modfiying Satshinm's oledterm code and making it sort of work, but it's highly unstable. See thread here:

satoshinm/oledterm#4

Krizzel87 has started his own repo, but I consider it a work in progress as it's known not to work properly:

https://github.com/Krizzel87/Oledterm_SH1106

Hope this helps

@peterbmckinley
Copy link
Author

Hi rm-hull any news on your proposed clean-room rebuild?

Peter

@peterbmckinley
Copy link
Author

BUMP

@rm-hull
Copy link
Owner

rm-hull commented Oct 30, 2020

Hi peter, sorry, I will try and get to this in the next few days ..

@peterbmckinley
Copy link
Author

peterbmckinley commented Oct 30, 2020 via email

@peterbmckinley
Copy link
Author

I guess this is permanently consigned to the Too Hard basket of history........

@thijstriemstra
Copy link
Collaborator

I guess this is permanently consigned to the Too Hard basket of history........

Time, life, sun, all gets in the way ;)

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

No branches or pull requests

3 participants