exciting-io / printer

Tools for exploring the possibilities of "internet of things" printing.
http://exciting.io/printer
MIT License
481 stars 94 forks source link

unexpted tLABEL #54

Closed JDHE closed 7 years ago

JDHE commented 7 years ago

Getting this error when I try to start up the client. Any ideas?

./pi-printer.rb:15: syntax error, unexpected tLABEL, expecting ')'
  def initialize(serial_port: "/dev/ttyAMA0")
                             ^
./pi-printer.rb:15: syntax error, unexpected ')', expecting keyword_end
./pi-printer.rb:137: syntax error, unexpected keyword_end, expecting $end
lazyatom commented 7 years ago

What version of ruby do you have?

On 5 Dec 2016, 04:52 +0000, JDHE notifications@github.com, wrote:

Getting this error when I try to start up the client. Any ideas?

./pi-printer.rb:15: syntax error, unexpected tLABEL, expecting ')' def initialize(serial_port: "/dev/ttyAMA0") ^ ./pi-printer.rb:15: syntax error, unexpected ')', expecting keyword_end ./pi-printer.rb:137: syntax error, unexpected keyword_end, expecting $end

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub (https://github.com/exciting-io/printer/issues/54), or mute the thread (https://github.com/notifications/unsubscribe-auth/AAAAkZ6fE_C4w4QekB_PE3DuyZ0F6_Psks5rE5irgaJpZM4LD2qo).

JDHE commented 7 years ago

I was getting /var/lib/gems permission issues when I tried to use the system Ruby (on the current Raspbian release on a Pi Zero). So I installed RVM and it installed ruby 1.9.3-p484 per the ruby-version file. I really want to get this to work. I have the printer working via serial using other methods like python, minicom, CUPS. I checked /dev/ttyAMA0 every possible way, /boot/cmdline.txt looks good, so it should be available.

Is it having an issue with serial_port? I don't have the TX from the printer connected to the rPi because I thought it wasn't necessary (since we are just trying to get the printer to RX). Could that be the issue?

I'm just not familiar enough with Ruby to understand what's causing this. Thanks for the response.

lazyatom commented 7 years ago

Short version: apologies, this is my fault, please pull, use RVM to install Ruby 2.3 (in the now-updated .ruby-version), run bundle install and try again.

Less-short version:

The error is caused because of a syntax change that's allowed in Ruby 2+, but not 1.9.3 (it's the serial_port: named keyword argument part). However, this is totally my fault - the server was developed against an earlier version of Ruby, but the raspberry pi script around a different one.

Sorry about that!

JDHE commented 7 years ago

Ha ha, and here I was telling myself it must be my own stupid noob problem. I will try it tonight! Thanks for the help!!