A queuejob hook (maybe other events as well) has problems cleanly reading max_run_res (and maybe other limits as well). An illustration is attached.
This example happens to be PBS Pro 13.1.600 on RHEL 6.4, I see the same thing with a recent 14.101 build on CentOS 7.2 as well.
There are a few things to note in the example. The problems are::
1) the write of max_run_res from the loop resulted in this:
max_run_res mem="[u:user1=5mb],[u:user2=10mb]",ncpus="[u:user1=5],[u:user2=10] <class 'pbs.v1._base_types.pbs_resource'>
Which is ALOMST correct, but note there is NO end double quote.
2) the write of str(pbs.server().max_run_res['ncpus']) resulted in None, which is wrong.
3) the write of str(pbs.server().max_run_res) resulted in only the mem part of the attribute, no ncpus, which is wrong.
Special mention should go to the fact that the same hook WORKS in pbs_python --hook, even though that the hook .data file that gets generated has an oddity (PP-449) on the max_run_res line (it's all in the illustration).