izderadicka / xapi-back

Simple backup tool for Xen Api - backups VMs images
2 stars 3 forks source link

Script comatible with python 3.6 or above #21

Open forall opened 6 years ago

forall commented 6 years ago

Hi, All the time I run your script on FreeNAS, but after the latest upgrade I have problem with script, I think the problem is python3.6.. Did you test your script with the newer python version?

python setup.py install Traceback (most recent call last): File "setup.py", line 22, in m=re.search(r"version\s=\s'([\d.]+)'", file(pkg_file).read()) NameError: name 'file' is not defined

forall commented 6 years ago

I found on freenas a python2.7, and once again install a xapi-back, and you can see the problem still occur...

xapi-back # python2.7 setup.py install --record files.txt running install running build running build_py running build_scripts running install_lib copying build/lib/xapi_back/util.py -> /usr/local/lib/python2.7/site-packages/xapi_back copying build/lib/xapi_back/common.py -> /usr/local/lib/python2.7/site-packages/xapi_back copying build/lib/xapi_back/http.py -> /usr/local/lib/python2.7/site-packages/xapi_back copying build/lib/xapi_back/XenAPI.py -> /usr/local/lib/python2.7/site-packages/xapi_back copying build/lib/xapi_back/commands/backup_batch.py -> /usr/local/lib/python2.7/site-packages/xapi_back/commands copying build/lib/xapi_back/commands/backup_one.py -> /usr/local/lib/python2.7/site-packages/xapi_back/commands copying build/lib/xapi_back/commands/init.py -> /usr/local/lib/python2.7/site-packages/xapi_back/commands copying build/lib/xapi_back/commands/hosts.py -> /usr/local/lib/python2.7/site-packages/xapi_back/commands copying build/lib/xapi_back/commands/list.py -> /usr/local/lib/python2.7/site-packages/xapi_back/commands copying build/lib/xapi_back/commands/srs.py -> /usr/local/lib/python2.7/site-packages/xapi_back/commands copying build/lib/xapi_back/commands/restore_one.py -> /usr/local/lib/python2.7/site-packages/xapi_back/commands copying build/lib/xapi_back/commands/disable.py -> /usr/local/lib/python2.7/site-packages/xapi_back/commands copying build/lib/xapi_back/commands/enable.py -> /usr/local/lib/python2.7/site-packages/xapi_back/commands copying build/lib/xapi_back/init.py -> /usr/local/lib/python2.7/site-packages/xapi_back copying build/lib/xapi_back/logmail.py -> /usr/local/lib/python2.7/site-packages/xapi_back copying build/lib/xapi_back/cli.py -> /usr/local/lib/python2.7/site-packages/xapi_back copying build/lib/xapi_back/provision.py -> /usr/local/lib/python2.7/site-packages/xapi_back copying build/lib/xapi_back/storage.py -> /usr/local/lib/python2.7/site-packages/xapi_back byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/util.py to util.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/common.py to common.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/http.py to http.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/XenAPI.py to XenAPI.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/commands/backup_batch.py to backup_batch.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/commands/backup_one.py to backup_one.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/commands/init.py to init.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/commands/hosts.py to hosts.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/commands/list.py to list.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/commands/srs.py to srs.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/commands/restore_one.py to restore_one.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/commands/disable.py to disable.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/commands/enable.py to enable.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/init.py to init.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/logmail.py to logmail.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/cli.py to cli.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/provision.py to provision.pyc byte-compiling /usr/local/lib/python2.7/site-packages/xapi_back/storage.py to storage.pyc running install_egg_info running egg_info writing requirements to src/xapi_back.egg-info/requires.txt writing src/xapi_back.egg-info/PKG-INFO writing top-level names to src/xapi_back.egg-info/top_level.txt writing dependency_links to src/xapi_back.egg-info/dependency_links.txt reading manifest file 'src/xapi_back.egg-info/SOURCES.txt' writing manifest file 'src/xapi_back.egg-info/SOURCES.txt' removing '/usr/local/lib/python2.7/site-packages/xapi_back-0.3.8-py2.7.egg-info' (and everything under it) Copying src/xapi_back.egg-info to /usr/local/lib/python2.7/site-packages/xapi_back-0.3.8-py2.7.egg-info running install_scripts copying build/scripts-2.7/xb -> /usr/local/bin changing mode of /usr/local/bin/xb to 755 writing list of installed files to 'files.txt'

/usr/local/bin/xb list Traceback (most recent call last): File "/usr/local/bin/xb", line 6, in cli.main(sys.argv[1:]) File "/usr/local/lib/python2.7/site-packages/xapi_back/cli.py", line 279, in main cmd, mail_log_handler = prepare_env(sys_args) File "/usr/local/lib/python2.7/site-packages/xapi_back/cli.py", line 223, in prepare_env cmd_classes=load_commands() File "/usr/local/lib/python2.7/site-packages/xapi_back/cli.py", line 209, in load_commands m=importlib.import_module('xapi_back.commands.'+mod) File "/usr/local/lib/python2.7/importlib/init.py", line 37, in import_module import(name) File "/usr/local/lib/python2.7/site-packages/xapi_back/commands/hosts.py", line 8, in from tabulate import tabulate ImportError: No module named tabulate

izderadicka commented 6 years ago

looks like python on is missing setuptools - then you need to install tabulate manually - easiest way is to install pip and then use it to install tabulate. ( Or install setuptools and then run again xb setup).

forall commented 6 years ago

Hi, I try install with pip3.6 but I get error:

pip3.6 install git+https://github.com/izderadicka/xapi-back.git#egg=xapi-back Collecting xapi-back from git+https://github.com/izderadicka/xapi-back.git#egg=xapi-back Cloning https://github.com/izderadicka/xapi-back.git to /var/tmp/pip-build-jdr6o6gb/xapi-back Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/var/tmp/pip-build-jdr6o6gb/xapi-back/setup.py", line 22, in m=re.search(r"version\s=\s'([\d.]+)'", file(pkg_file).read()) NameError: name 'file' is not defined

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /var/tmp/pip-build-jdr6o6gb/xapi-back/

izderadicka commented 6 years ago

Once more - xapi-back is 2.7 only