wp rest api json到xml文件的PHP错误

时间:2015-08-31 12:57:53

标签: api rest

您好我是新手学习PHP并使用wp rest api处理一个小项目将json数组转换为xml文件,我在尝试将数组转换为xml文件时遇到以下错误而我迷失了什么导致以下错误。

致命错误:在第15行的/home/eggshell/spareegg.net/wprest_test/wprest_phptest-xml.php中的非对象上调用成员函数addChild()

remote: [lun ago 31 14:34:52 CEST 2015] [PRE] Creando nuevo entorno virtual...
remote: [lun ago 31 14:34:52 CEST 2015] Using base prefix '/usr'
remote: [lun ago 31 14:34:52 CEST 2015] New python executable in /var/www/myproject/venvs/venv-pre/bin/python3
remote: [lun ago 31 14:34:52 CEST 2015] Also creating executable in /var/www/myproject/venvs/venv-pre/bin/python
remote: [lun ago 31 14:34:53 CEST 2015] Installing setuptools, pip...done.
remote: [lun ago 31 14:34:53 CEST 2015] Running virtualenv with interpreter /usr/bin/python3
remote: [lun ago 31 14:34:53 CEST 2015] [PRE] Creando nuevo entorno virtual...OK
remote: [lun ago 31 14:34:53 CEST 2015] [PRE] Instalando dependencias de requirements.txt...
remote: [lun ago 31 14:34:54 CEST 2015] Downloading/unpacking Django==1.8.4 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 1))
remote: [lun ago 31 14:34:55 CEST 2015] Downloading/unpacking Pillow==2.9.0 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 2))
remote: [lun ago 31 14:34:56 CEST 2015] Running setup.py (path:/tmp/pip_build_lostcitizen/Pillow/setup.py) egg_info for package Pillow
remote: [lun ago 31 14:34:56 CEST 2015]
remote: [lun ago 31 14:34:57 CEST 2015] Downloading/unpacking defusedxml==0.4.1 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 3))
remote: [lun ago 31 14:34:57 CEST 2015] Running setup.py (path:/tmp/pip_build_lostcitizen/defusedxml/setup.py) egg_info for package defusedxml
remote: [lun ago 31 14:34:57 CEST 2015]
remote: [lun ago 31 14:34:57 CEST 2015] Downloading/unpacking django-allauth==0.23.0 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 4))
remote: [lun ago 31 14:34:57 CEST 2015] Running setup.py (path:/tmp/pip_build_lostcitizen/django-allauth/setup.py) egg_info for package django-allauth
remote: [lun ago 31 14:34:57 CEST 2015]
remote: [lun ago 31 14:34:57 CEST 2015] Downloading/unpacking django-emoji==2.0.0 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 5))
remote: [lun ago 31 14:34:58 CEST 2015] Downloading/unpacking django-messages==0.5.1 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 6))
remote: [lun ago 31 14:34:58 CEST 2015] Running setup.py (path:/tmp/pip_build_lostcitizen/django-messages/setup.py) egg_info for package django-messages
remote: [lun ago 31 14:34:59 CEST 2015]
remote: [lun ago 31 14:34:59 CEST 2015] Downloading/unpacking djangorestframework==3.2.2 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 7))
remote: [lun ago 31 14:34:59 CEST 2015] Downloading/unpacking gunicorn==19.3.0 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 8))
remote: [lun ago 31 14:34:59 CEST 2015] Downloading/unpacking oauthlib==1.0.3 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 9))
remote: [lun ago 31 14:34:59 CEST 2015] Running setup.py (path:/tmp/pip_build_lostcitizen/oauthlib/setup.py) egg_info for package oauthlib
remote: [lun ago 31 14:35:00 CEST 2015]
remote: [lun ago 31 14:35:00 CEST 2015] Downloading/unpacking psycopg2==2.6.1 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 10))
remote: [lun ago 31 14:35:00 CEST 2015] Running setup.py (path:/tmp/pip_build_lostcitizen/psycopg2/setup.py) egg_info for package psycopg2
remote: [lun ago 31 14:35:00 CEST 2015]
remote: [lun ago 31 14:35:00 CEST 2015] Downloading/unpacking python3-openid==3.0.6 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 11))
remote: [lun ago 31 14:35:00 CEST 2015] Running setup.py (path:/tmp/pip_build_lostcitizen/python3-openid/setup.py) egg_info for package python3-openid
remote: [lun ago 31 14:35:00 CEST 2015]
remote: [lun ago 31 14:35:00 CEST 2015] warning: no files found matching 'NOTICE'
remote: [lun ago 31 14:35:00 CEST 2015] warning: no files found matching 'CHANGELOG'
remote: [lun ago 31 14:35:00 CEST 2015] warning: no files found matching 'README.md' under directory 'examples'
remote: [lun ago 31 14:35:00 CEST 2015] warning: no files found matching '*.css' under directory 'doc'
remote: [lun ago 31 14:35:00 CEST 2015] warning: no files found matching '*.html' under directory 'doc'
remote: [lun ago 31 14:35:00 CEST 2015] Downloading/unpacking requests==2.7.0 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 12))
remote: [lun ago 31 14:35:01 CEST 2015] Downloading/unpacking requests-oauthlib==0.5.0 (from -r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 13))
remote: [lun ago 31 14:35:01 CEST 2015] Downloading requests_oauthlib-0.5.0-py2.py3-none-any.whl
remote: [lun ago 31 14:35:01 CEST 2015] Downloading/unpacking python-openid>=2.2.5 (from django-allauth==0.23.0->-r /var/www/myproject/src/myproject-pre/requirements/pre.txt (line 4))
remote: [lun ago 31 14:35:01 CEST 2015] Running setup.py (path:/tmp/pip_build_lostcitizen/python-openid/setup.py) egg_info for package python-openid
remote: [lun ago 31 14:35:01 CEST 2015]
remote: [lun ago 31 14:35:01 CEST 2015] warning: no files found matching 'CHANGELOG'
remote: [lun ago 31 14:35:01 CEST 2015] warning: no files found matching '*.css' under directory 'doc'
remote: [lun ago 31 14:35:01 CEST 2015] warning: no files found matching '*.html' under directory 'doc'
remote: [lun ago 31 14:35:01 CEST 2015] Installing collected packages: Django, Pillow, defusedxml, django-allauth, django-emoji, django-messages, djangorestframework, gunicorn, oauthlib, psycopg2, python3-openid, requests, requests-oauthlib, python-openid
remote: [lun ago 31 14:35:02 CEST 2015] Cleaning up...
remote: [lun ago 31 14:35:02 CEST 2015] Exception:
remote: [lun ago 31 14:35:02 CEST 2015] Traceback (most recent call last):
remote: [lun ago 31 14:35:02 CEST 2015] File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
remote: [lun ago 31 14:35:02 CEST 2015] status = self.run(options, args)
remote: [lun ago 31 14:35:02 CEST 2015] File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
remote: [lun ago 31 14:35:02 CEST 2015] requirement_set.install(install_options, global_options, root=options.root_path)
remote: [lun ago 31 14:35:02 CEST 2015] File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
remote: [lun ago 31 14:35:02 CEST 2015] requirement.install(install_options, global_options, *args, **kwargs)
remote: [lun ago 31 14:35:02 CEST 2015] File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install
remote: [lun ago 31 14:35:02 CEST 2015] self.move_wheel_files(self.source_dir, root=root)
remote: [lun ago 31 14:35:02 CEST 2015] File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files
remote: [lun ago 31 14:35:02 CEST 2015] pycompile=self.pycompile,
remote: [lun ago 31 14:35:02 CEST 2015] File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 206, in move_wheel_files
remote: [lun ago 31 14:35:02 CEST 2015] clobber(source, lib_dir, True)
remote: [lun ago 31 14:35:02 CEST 2015] File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 193, in clobber
remote: [lun ago 31 14:35:02 CEST 2015] os.makedirs(destsubdir)
remote: [lun ago 31 14:35:02 CEST 2015] File "/usr/lib/python2.7/os.py", line 157, in makedirs
remote: [lun ago 31 14:35:02 CEST 2015] mkdir(name, mode)
remote: [lun ago 31 14:35:02 CEST 2015] OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/django'
remote: [lun ago 31 14:35:02 CEST 2015]
remote: [lun ago 31 14:35:02 CEST 2015] Storing debug log for failure in /home/lostcitizen/.pip/pip.log
remote: [lun ago 31 14:35:02 CEST 2015] [PRE] Instalando dependencias de requirements.txt... OK

0 个答案:

没有答案