json - CherryPy & php: can't load class of data from pickle, but works from ssh on server -
i using cherrypy generate , parse data php webpage, getting error can't replicate locally or via ssh (logging server , running python script prompt works okay).
the current sticky error message is:
file "modules/flex.py", line 335, in convert ref_data = cpickle.load(f2) attributeerror: 'module' object has no attribute 'data' another pickle loads fine in previous line, , both pickles represent class objects variety of dictionaries , lists of lists. 1 of these works, , other doesn't.
in general cherrypy, what's best way isolate error messages? can run /cp/ function it's url, , can @ webserver error log, these 2 don't give error message (or correct error).
on other side, in php, using code retrieve json object representing python list of lists:
$obj = file_get_contents($senddata); $sue = json_decode($obj); is acceptable method? what's best way pass , generate php arrays python data structures?
i think have different issues:
your code not working because pythonpath (
sys.path) not same in python interpreter, when connected trough ssh , in python running serve webapp. because tying deserialize data module, exists (otherwiseimporterror) not haveclassdeclaration ofdata, file same name module in same directory , trying findclass datain file. when serialize don't save class declaration, how reconstruct object.what mean "the correct error"?, when environment "production", cherrypy default log traceback of last error, can of course change default behavior custom error handling.
you should stick json communication betweeen languages, pretty standard , efficient parsed in both sides.
i hope helps.
Comments
Post a Comment