|
Post by swanseamick on Jul 16, 2013 0:48:14 GMT -8
I modified the 'Sound Alert' control to send B2 to my Pi URL, but when I click Validate, or click the button I get an error!
Traceback reads as follows:
all the following refer to File: "/usr/local/lib/python2.7/dist-package/web/application.py",
Line 239, in process return self.handle() Line 230, in handle return self._delegate(fn, self.fvars, args) Line 420, in _delegate return handle_class(cls) Line 396 in handle_class return tocall(*args) TypeError: POST() takes exactly 1 argument (2 given) 192.168.1.100:49505 - - [16/Jul/2013 09:20:45] "HTTP/1.1 POST /" - 500 Internal Server Error
Any clues what is wrong?
Mike
|
|
|
Post by SDL on Jul 16, 2013 14:00:32 GMT -8
Mike,
I just noticed that the system wiped out my response to this earlier today. How irritating.
It looks like you might have a space somewhere that causes the POST() argument. Just *guessing*.
Turn on debug in the config.py file, send your button again and post the results (taking out any personal information and passwords) and I'll bet we can help.
Best regards,
BP
|
|
|
Post by swanseamick on Jul 16, 2013 22:55:24 GMT -8
BP
I amended Config.py, set DEBUG = True, recompiled it and the results haven't changed from original scenario.
I can see the 'If Debug()' statements and their associated 'print' statements scattered around the code, but they are not being triggered.
Follow up: After some experimentation, discovered 'print' statements should 'print' to the 'Console'. As I am getting no prints when I run RasPiConnectServer, it would appear problems lie outside RasPiConnectServer, before any of its files are being used i.e. setting DEBUG to True is not triggering any 'prints' whatsoever.
Without knowing the sequence of events/calls that should occur when button or Validate is pressed I am unable to track any further.
Can you supply a noddies/idiots guide to sequence of events that should occur when Validate is pressed. This will at least give users a BIG clue as to how the RasPiConnectServer system operates.
I strongly suspect that error is occuring before any of the RasPiConnectServer software comes into play! Mike
|
|
|
Post by SDL on Jul 17, 2013 7:57:41 GMT -8
Mike,
Are you starting the server with startserver.sh? It should start on the screen.
Did you redirect the server using nohup? If so, ALL output is directed into nohup.out
Check out the ReadMe in the top directory.
If you used the rc.local script provided, then the output is in /var/log/RasPiConnectServer.log
We will add an explanation to the users manual regarding validate. The sequence is this:
1) Sends a refresh command to the Pi from the RasPiConnect App with Validate set.
2) Server responds not be executing the command, but replying that "Yes, I have received this command and you are Validated"
3) The App turns the Validate LED green if successful, red if not and orange if you are in demo mode.
Go into settings to validate your entire setup.
BP
|
|
|
Post by swanseamick on Jul 17, 2013 8:07:38 GMT -8
BP
I'm starting server at command prompt after I login as Pi or Root (e.g. python RasPiConnectServer.py).
After setting DEBUG = True, all I get printed are the two http messages at startup, then the traceback mentioned, when I press Validate.
NO debug messages are received at all.
I know I am communicating with server, as requesting Version in Browser works, (as well getting traceback error messages).
Mike
|
|
|
Post by swanseamick on Jul 17, 2013 8:26:14 GMT -8
BP
When I suggested an Idiots Guide, I was hoping it would explain the following:
There are various 'Execute' Modules for each Control on the page, but in my case, the ActionButton control is not making a sound, so the ExecuteActionButton module is not being called. So I need a guide to explain the sequence of events leading up to this module being called into play, along the lines of:
a. Validate triggers App to Refresh b. Message received in Server in Class xxxx in RasPiConnectServer.py c. Class xxx calls yyy in Web/Application.py ... ... z. RasPiConnectServer class zzz responds with "yes, I received this command ok"
i.e. something with a bit more meat in it.
This would serve 2 purposes 1. Explain how system works, so we can understand more fully how to get it to perform tasks we want. 2. Explain where to look if things don't work properly.
Hope this makes sense
Mike
|
|
|
Post by SDL on Jul 17, 2013 10:22:22 GMT -8
Mike,
Thanks for the comments about explaining the Validate process. We will add it.
I'm not sure what you are doing. Do you have another process of RasPiConnect running in the background?
We did a clean install from the git archive, changed DEBUG = True, type "sh startsever.sh" from the main directory, hit refresh on our App and got lots of stuff.
Here's what a normal validate looks like on the console screen.
If you run the server as "nohup sh startserver.sh &" it will put all of the output in a file. Use "tail -f nohup.out" to watch it real time.
166.147.83.153:54732 - - [17/Jul/2013 18:19:49] "HTTP/1.1 POST /RasPi" - 200 OK <XMLObjectXMLRequests><XMLCOMMAND><VALIDATE>YES</VALIDATE><OBJECTSERVERID>FB-1</OBJECTSERVERID><OBJECTNAME>Feedback Button On</OBJECTNAME><USERNAME>027C697DC48E9F294D450E5DF7372253</USERNAME><PASSWORD>01A4AFA6E8030895733322634DA47D14</PASSWORD><OBJECTTYPE>17</OBJECTTYPE><OBJECTFLAGS>0</OBJECTFLAGS><OBJECTACTION>SINGLEPUSH</OBJECTACTION><OBJECTID>3018</OBJECTID></XMLCOMMAND></XMLObjectXMLRequests> XMLCOMMAND: USERNAME: PASSWORD: OBJECTNAME: Feedback Button On OBJECTTYPE: 17 OBJECTSERVERID: FB-1 OBJECTID: 3018 027C697DC48E9F294D450E5DF7372253 01A4AFA6E8030895733322634DA47D14 objectType = 17 objectServerID = FB-1 VALIDATE=YES objectServerID = FB-1 Local user objects returns: FEEDBACK_ACTION_BUTTON_UITYPE found VALIDATE=YES objectServerID = FB-1 objectServerID = FB-1 final outgoing data =<XMLRESPONSES><XMLCOMMAND><OBJECTID>3018</OBJECTID><OBJECTSERVERID>FB-1</OBJECTSERVERID><OBJECTTYPE>17</OBJECTTYPE><OBJECTFLAGS>0</OBJECTFLAGS><RASPICONNECTSERVERVERSIONNUMBER>2.5</RASPICONNECTSERVERVERSIONNUMBER><RESPONSE><![CDATA[VALIDATED]]></RESPONSE></XMLCOMMAND></XMLRESPONSES>
|
|
|
Post by swanseamick on Jul 17, 2013 11:56:16 GMT -8
BP Sequence was: RaspberryPi Logged in as User 'Pi' Change directory to /home/pi/RasPiConnectServer Entered 'nohup python RasPiConnectServer.py' at prompt Started App on Ipad Highlighted Control via Panel Setup Clicked Edit Selection Checked 'Select System' was set to RaspberryPi Then pressed 'Validate' button On RaspberryPi, stopped RasPiConnectServer Content of nohup.out is as follows: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 239, in process return self.handle() File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 230, in handle return self._delegate(fn, self.fvars, args) File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 420, in _delegate return handle_class(cls) File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 396, in handle_class return tocall(*args) TypeError: POST() takes exactly 1 argument (2 given) 192.168.1.100:49975 - - [17/Jul/2013 20:39:14] "HTTP/1.1 POST /" - 500 Internal Server Error 192.168.1.89:9600/This differs from running program in foreground insofar as the two http statements at end of nohup.out occur immediately upon starting server. The rest of nohup.out is printed to console You'll note there are no debug messages in nohup.out Mike PS No other RasPiConnectServers running in background
|
|
|
Post by SDL on Jul 17, 2013 14:31:02 GMT -8
OK, let's try this.
1) Add a new control, leave all the values the same and just change the server address to point to your Pi. Hit validate.
2) If that doesn't work, then install a new version of RasPiConnect Server from the github archive, modify your Config.py file and try #1 again.
Clearly you are talking to your server. I assume the Server Report on the App Settings screen shows your server as green?
BP
|
|
|
Post by swanseamick on Jul 17, 2013 22:22:04 GMT -8
BP
Sorry, your assumption is incorrect. Whenever I try to get a Server Report in App, I get exactly the same error messages as I get when I try to Validate, and the Server Status LED stays Black (It goes Red if Server not running on Pi)
The final line of the error message: "500 - Internal Server error", comes from Web.py package, not from one of your RasPiConnect modules, therefore problem seems to be between RasPiConnect and Web.py, so not something a user can influence.
I suspect web.py may not be installed correctly. Is there any further tests I can do to check correct installation of web.py?
This is another reason why 'apt-get install RasPiConnect', should install everything, including a check for all dependencies, such as web.py. That way, you and the users know all the correct files are being installed. The current installation method relies too much on the skills of your user - especially newbies like myself. After all, that is the whole raison d'etre of the Raspberry Pi, to encourage computer newbies into computing.
Mike
|
|
|
Post by SDL on Jul 18, 2013 8:08:04 GMT -8
OK, I definitely have a new piece of information. The server status goes black. It's a problem with the URL and not the control I would guess.
Could you post the URL address that you have as a system URL? I'm wondering if there is a blank following the final slash. Or a blank embedded in the URL.
I'm thinking the key is "TypeError: POST() takes exactly 1 argument (2 given)" and that sounds like a malformed URL to me.
It's non-trivial to set up a private apt repository and since the code is in Python, it even is more complex. However, your point is well taken regarding dependencies and where to get them.
BP
|
|
|
Post by swanseamick on Jul 18, 2013 9:01:52 GMT -8
BP The entry in Config.py is as follows (cut & pasted): LOCALURL = "http://192.168.1.89:9600/" In App, System URL is 192.168.1.89:9600I spotted System URL lacked the final '/' so tried adding it, but problem is still there (with or without '/') There definitely is NO extra space anywhere Mike NB Adding space to System URL in App causes the led to go Red and URL is displayed as
|
|
|
Post by SDL on Jul 18, 2013 9:58:52 GMT -8
Mike,
We are both running Python 2.7, so that's not the problem.
I assume the .90 is a typo in your NB?
Run the command: "sudo easy_install web.py"
My results: --------- Searching for web.py Best match: web.py 0.37 web.py 0.37 is already the active version in easy-install.pth
Using /usr/local/lib/python2.7/dist-packages Processing dependencies for web.py Finished processing dependencies for web.py ----------
Are you running as the "pi" user and not root?
One more question:
From the manual:
System URLs are what RasPiConnect uses to communicate to the servers. If you are on an internal wireless network, these URLs are typically of the form: "http://ipnumber:portnumber/raspi" (Ex. "http://192.168.1.130:5700/raspi"). If you put your Raspberry Pi on an external network connected to the internet, they would be of the form "http://qualfieddomain:portnumber/raspi" (Ex. "http://raspi.example.com:5700:/raspi"). You can route your Raspberry Pi through your router (port forwarding) to only expose one port to the Internet. If you do this, make sure you change your passwords to something very complicated!
Do you have the system URL in the App in the form of: "http://192.168.1.130:5700/raspi" ?
BP
|
|
|
Post by swanseamick on Jul 18, 2013 10:51:23 GMT -8
BP All this time we've been conversing, and this is first time you've mentioned adding '/raspi' to end of URL, despite last two posts from me clearly showing I hadn't appended it. Nowhere in the documentation is this emphasised, and would you believe it, that was the problem!!!!! In my defense, the sample URL shown in App when adding a new URL doesn't mention it - this needs changing, and the comments in Config.py need to show this as well. (You ought to know no-one reads the manual, and need leading by the hand) Also the documentation (seen above) contradicts itself, in one case it shows 192.168.1.130:5700/raspi and in other example, adds an extra colon before /raspi. Never mind, we got there in the end. Many thanks. Now time to play. Mike
|
|
|
Post by SDL on Jul 18, 2013 11:07:30 GMT -8
Mike,
True, I didn't notice that you hadn't put /raspi at the end. Mea Culpa.
We will fix the extra ":" in the documentation. I'm looking for the case of "192.168.1.130:5700/raspi" - no http:// - and I'm not seeing it. Could you tell me where you found that?
I've asked Engineering to fix the sample inside the App. Now that was bad!!!!! We'll add a comment in the config.py too.
BP
|
|