Project

General

Profile

Problem with JSON:parse on Raspberry PI

Added by Franz Winter almost 11 years ago

Hi

1. Very nice framework!!!

2. I have a problem with JSON::parse()

I wanna parse JSON data from http://www.openweathermap.org/ on Raspberry PI but I have a strange problem (Used source code see attachment).

When I use the JSON data from "http://api.openweathermap.org/data/2.5/forecast?lat=35&lon=139" Wt::JSON::parse works perfectly but when

I use data from "http://api.openweathermap.org/data/2.5/forecast?lat=48.116498&lon=14.021354&mode=json&units=metric&lang=de" the application on the Raspberry PI craches and I got following error:

\"terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::spirit::qi::expectation_failure<_gnu_cxx::_normal_iterator<char const*, std::string> > > >'

what(): boost::spirit::qi::expectation_failure

Child terminated with signal = 0x6 (SIGABRT)\"

This exeption text is not really helpful for me, so can somebody give me a hint where the problem comes from?

I am using Wt 3.3.2 and Boost 1.4.9 on the Raspberry.

When I run the same code under windows on Wt 3.3.2 or 3.3.3 and Boost 1.5.5 I can parse the JSON data.

Thx

Frank

code.cpp (29.8 KB) code.cpp

Replies (4)

RE: Problem with JSON:parse on Raspberry PI - Added by Wim Dumon almost 11 years ago

Hey,

First thing that I think of is that this could be a UTF-8 problem of some kind. In our test suite, test/JsonParserTest.C verifies unicode sequences. Can you check if the test suite runs correctly on your rpy?

BR,

Wim.

RE: Problem with JSON:parse on Raspberry PI - Added by Franz Winter almost 11 years ago

Hi Wim

Thanks for you hint with the test suit.

So for me it seams that the test suite is a binary program that I have to build with cmake...

What I did on the Rasp to build the test suite:

sudo cmake -DWT_SOURCE_DIR=/usr/lib/Wt -DEXAMPLES_CONNECTOR="wt;wthttp" /usr/lib/Wt/test

sudo make

But it doesn't build

[ 33%] Building CXX object CMakeFiles/test.dir/http/HttpClientTest.o

/usr/lib/Wt/test/http/HttpClientTest.C:16:36: fatal error: Wt/Test/WTestEnvironment: File or directory not found

compilation terminated.

Cmake[2]: * wait:

make[2]: *

make[2]: * wait:

make[1]: * [CMakeFiles/test.dir/all] Error 2

make: * [all]

I looked for /usr/bin/Wt/Test/WTestEnvironment but there is no file WTestEnvironment. Do you know where I can find this file?

Thx

Frank

RE: Problem with JSON:parse on Raspberry PI - Added by Franz Winter almost 11 years ago

Update:

The used version of Wt on Rasyberry was wrong in the first message. I'am using the Wt version from "apt-get install witty" which is 3.2.1.

RE: Problem with JSON:parse on Raspberry PI - Added by Franz Winter almost 11 years ago

I solved my problem with switching to version 3.3.2 under Arch Linux.

    (1-4/4)