I am getting an error with my new program that I apparently missed before. It occurs when trying to post data to Pastebin, and I am getting "attempt to concatenate nil and string" on line 396. The only variable on that line is postText, which is properly defined on line 359.
If anyone could take a look at this, I would be very grateful.
Code here: http://pastebin.com/DPJVtctz
What have I missed?
Started by Cranium, Nov 25 2012 10:30 AM
10 replies to this topic
#1
Posted 25 November 2012 - 10:30 AM
#2
Posted 25 November 2012 - 11:56 AM
"api_paste_code="..textutils.urlEncode(postText)
Should be:
"api_paste_code="..textutils.urlEncode(postText)..&..
???
Should be:
"api_paste_code="..textutils.urlEncode(postText)..&..
???
#3
Posted 25 November 2012 - 12:06 PM
The ampersands go between each key=pair set. There doesn't need to be one at the very end (Although most well-coded CGI scripts will just ignore it instead of error)
I think the error is with line 359, where you define the postText variable to be local.
It enters a while loop, and an if, so might not have access to the variable up two levels of scope. But I'm not possitive that is it.
I think the error is with line 359, where you define the postText variable to be local.
It enters a while loop, and an if, so might not have access to the variable up two levels of scope. But I'm not possitive that is it.
#4
Posted 25 November 2012 - 12:09 PM
Nah, that's not it. The last line in the http.post can't have the "&" in it, otherwise I'll get a bad response from Pastebin.
I did test the variable, because that is the first thing I thought of too. I had it save that text to a file, and it copied perfectly. I'll try making it a global and see if that worked.
Edit: Nope, changing it to global did nothing.
dissy, on 25 November 2012 - 12:06 PM, said:
The ampersands go between each key=pair set. There doesn't need to be one at the very end (Although most well-coded CGI scripts will just ignore it instead of error) I think the error is with line 359, where you define the postText variable to be local. It enters a while loop, and an if, so might not have access to the variable up two levels of scope. But I'm not possitive that is it.
Edit: Nope, changing it to global did nothing.
Edited by Cranium, 25 November 2012 - 12:10 PM.
#5
Posted 25 November 2012 - 12:11 PM
Then what about just this:
"api_paste_code="..textutils.urlEncode(postText)..
because before that, you have two ..
.. "api_paste_code="..textutils.urlEncode(postText)..
is that it?
I'm glad if i could help you:-D
Edit: well, i 'm sorry but right now my brain is totally blacked out... I will Take a bigger look at your 'smartpaste' and then tell you, if i find anything special, or wrong..
"api_paste_code="..textutils.urlEncode(postText)..
because before that, you have two ..
.. "api_paste_code="..textutils.urlEncode(postText)..
is that it?
I'm glad if i could help you:-D
Edit: well, i 'm sorry but right now my brain is totally blacked out... I will Take a bigger look at your 'smartpaste' and then tell you, if i find anything special, or wrong..
#6
Posted 25 November 2012 - 12:16 PM
Mikk809h, on 25 November 2012 - 12:11 PM, said:
Then what about just this: "api_paste_code="..textutils.urlEncode(postText).. because before that, you have two .. .. "api_paste_code="..textutils.urlEncode(postText).. is that it? I'm glad if i could help you:-D
print("These are the same thing")
print(
"These "..
"are "..
"the "..
"same "..
"thing"
)
#7
Posted 25 November 2012 - 12:20 PM
I am sorry then... I will take a bigger look at your code, then. If i find anything wrong, i would post it directly to you.
:-P
:-P
#8
Posted 25 November 2012 - 12:22 PM
My appologies, hmm I really don't see what is wrong with that code. One of those "Grr it should work!" kinda things ;}
I hope more eyes will be able to help, and you figure it out. Good luck!
I hope more eyes will be able to help, and you figure it out. Good luck!
#9
Posted 25 November 2012 - 01:01 PM
It's not line 396, it's actually line 395. "pasteName" should be "postName", I believe.
#10
Posted 25 November 2012 - 01:08 PM
Kingdaro, on 25 November 2012 - 01:01 PM, said:
It's not like 396, it's actually line 395. "pasteName" should be "postName", I believe.
Haha, that's the problem. Nice eye. Surprised a lot of people missed that...
After that this line then errors:
write(string.rep(" ", (b-(sResponse/2)-2)))
And cranium: Line 424 you made made mistakes:
term.setTExttColor(colors.white)
edit: after that, clicking 'ok' each time it uploads to pastebin goes back to 'save as' and keeps uploading
#11
Posted 25 November 2012 - 01:11 PM
OMG..... wow.
I am going to have to fix those errors... but at least we found the first problem, just to find more ;_;
I am going to have to fix those errors... but at least we found the first problem, just to find more ;_;
3 user(s) are reading this topic
0 members, 3 guests, 0 anonymous users











