Award
Congratulations DJ Sures, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Error On Line 25: Missing String Quotes

Assistance Requested

Help Dave Schulpius with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

Dave Schulpius claims to have checked these sources:
 
#1

I'm getting an error message in one of my scripts that is giving me some trouble. It's a random error meaning that it will happen every few times the command is run. It's set in a loop so it will repeat. Sometimes it will even cause the connection between the EZB and computer to cut off. Here'e the error:

Code:


Error on line 25: Missing String Quotes or Invalid Expression at index 14: "


and

Code:


Error on line 25: Missing String Quotes or Invalid Expression at index 15: "



Here's the script to happens in. Seems to center around the print commands. Once I removed the print command at line 25 and the error skipped to the next one. I've also expanded the sleep() commands thinking it was running too fast but it does not help. Thanks for looking :

Code:


# This Script will return the actual position number of the left catrrage
# #from the Kangaroo withough the 1,p in the begining.
# #Returning feedback with the 1,p causes problems.
# #Do Not Delete. Other scripts depend on this script!

# -------------------------------------
# Get Roo position

uartWrite(2, 2, "2, Getp", 0x0d)

:waitForData
Sleep(30)

$y_lft = UartAvailable(2, 2)
Sleep(30)
print("Bytes in buffer:" + $y_lft)

if ($y_lft < 6)
# Go back and wait for data again because we did not receive the least number of expected bytes.
goto(waitForData)
endif
Sleep(30)
$Get_Lft_Carrage_P = UARTRead(2, 2, $y_lft)
Sleep(30)
print("Received: " + $Get_Lft_Carrage_P)

Sleep( 50 )

# -------------------------------
# Find out and print if the P is upper or lower case.
# Upper case means motor has finished move ans stoped.
# Lower Case means that motor is still moving.

$P_lft_or_p_lft = GetCharAt($Get_Lft_Carrage_P, 2) #Assign a variable to either a capitol P or Small case p returned by Kangaroo.

Print("P_lft_or_p_lft:" + $P_lft_or_p_lft)

# -----------------------------
# Defeat the P_lft_or_p_lft

if ($P_lft_or_p_lft = "p")
Goto(Lower_p_Split)
ELSEif ($P_lft_or_p_lft = "P")
Goto(Upper_P_Split)
endif

Sleep( 50 )

:Lower_p_Split

$Lft_Carrage_Position = Split($Get_Lft_Carrage_P, "p",1) #1,pXXXX is returned. Get everything after the Lower case p (P is case senceitive).
Sleep(30)
print("Received:" + $Lft_Carrage_Position)
Halt()

:Upper_P_Split
$Lft_Carrage_Position = Split($Get_Lft_Carrage_P, "P",1) #1,pXXXX is returned. Get everything after the Upper case P (P is case senceitive).
Sleep(30)
print("Received:" + $Lft_Carrage_Position)

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.


Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


#2

In addition I noticed that this error also seems to happen when there are over 9 or more bytes in the uart buffer. This call for information usually only returns 8 bytes but sometimes as the loop runs, more bytes then expected are reported in there. My loops keeps running until there are more then 6 bytes found in the buffer. Do you think this could be part of the cause?

#3

Here's what the debug window shows when I get disconnected from the conputer after the above error message:

Code:


Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 14: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Comm Err: System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at EZ_B.EZB.Sqf7viyWfV(Int32 , Byte[] cmdData)
BbytesToExpect: 16

Disconnected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Comm Err: System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at EZ_B.EZB.Sqf7viyWfV(Int32 , Byte[] cmdData)
BbytesToExpect: 2
?
Received: 0 0
Disconnected
Error on line 3: Not connected to EZ_B 0
Error on line 4: Not connected to EZ_B 0
Disconnected
Disconnected



*tired*

#4

Your data isn't printable. Stop printing it to the screen or use an array. Look down at your keyboard - only those characters are printable. And if you have a quote to print, it must be escaped.

Unless you are working with ascii data, you'll have to use binary commands.

#5

Now that i'm in front of a PC, to expand on your question...

The code that is generating an error is...

Code:


print("Received: " + $Get_Lft_Carrage_P)



So, that means the UART read is reading a " (quote) or unreadable character outside of the ascii chart.

Code:


$Get_Lft_Carrage_P = UARTRead(2, 2, $y_lft)



1) Did you look at line #25 and see that it is a print() Statement? The print statement can only print characters that are readable by a human, or they must be escaped. if data is stored in a variable that is not human readable, there's no way to print it. The variable manager can inspect it, or printhex will give the ascii value - because you can't print something that you cannot see.

2) Did you comment out the print() Statement?

#6

Thanks for the reply and suggestions. It's good to know someone cares.

It's odd that you say that my print command shouldn't be able to print anything. It's been showing me position for years now with the occasional error I mentioned. The script would just pass the error by in the loop and redo the request/print. It was not until the latest ez builder update and/or my v2 upgrade that I first started seeing this things stop and disconnect.

Yes I did disabled the first print command and it found a error with the next one so I'm sure you're right. I'll disabled the rest to see if this helps. Thanks again.

#7

I can see that the last update would have affected it because the previous version you were running was many months old - skipping multiple other updates.

That's like updating from Windows XP to Windows 10 and finding that things are different Grin

It's not the print statement that has changed. It's how variable are stored. The original design of ez-script was not to support binary operations, because it was a short sighted design. As more power users began connecting 3rd party hardware to the ez-b, there were more binary operations being attempted which resulted in errors. There are numerous threads over the last year on that subject, and a dozen EZ-Builder releases with release notes documenting the changes.

The moral of the story is that if you're a power user (Which you are), upgrading more frequently is important. It is only 4 clicks of the mouse to upgrade, the keyboard doesn't ever have to be touched to upgrade. EZ-Builder also informs you that a new version is available when loaded. Smile

#8

Thanks for the guidance DJ. Actually it's not that I forgot to upgrade EZ Builder, it's that I was busy completing my robot build between the time periods you mentioned. The scripts I'm using now were written back then and seemed to work nicely. Now that I have the robot mostly ready to accept more complex moment scripts is when I'm actually "power" using EZ Builder again. Thank goodness! Winky

So, back to my issue; I actually went back and commented out all the print commands. Sadly however this same error message is now happening on different command in the problem script. Here's that command now:

Code:


$P_lft_or_p_lft = GetCharAt($Get_Lft_Carrage_P, 2) #Assign a variable to either a capitol P or Small case p returned by Kangaroo.



Sounds like I may need to find a different way to write this script? I really don't know what changes I need to make to get this script to work. I'm wanting this script to send a Simple Serial command request through the Uart to the Kangaroo for position info, read that info when returned then assign a variable to it. The issues I was having before was that the returned position info looked like this:

Code:


1,pXXXX
or
1,PXXXX .


A upper case P would mean the movement was complete followed by the position. A lower case p would mean the moment was still going on followed by the current position.

Personally I really only need to know when the movement is complete. If there is a way to write a script that will look for a change from a lower case p to an upper case P that would work also. The above script that I wrote a while back could be modified to do this but I'm now not sure it is a workable script. Do you think this will work or is there a better way to write this? *confused*

#9

I assume the issue is with a new line completion.

What would probably benefit you is an actual plugin for this piece of hardware.

Where can i get one? Do i need the kangaroo or do i need additional components? I'll order one and create a plugin for you. That way you will no longer need complicated scripts to send/receive commands to this device.

It will operate similar to the ssc-32 and dynamixel by using virtual ports.

#10

Really nothing to contribute to this thread except DJ really kicks axx. I don't personally use a kangaroo but it seems he's on a plug in making/fixing rampage!