0

I'm using AnyTree in an independent environment where there is no pip (testcomplete).

I started by moving the anytree folders to the required folders, and started getting import error for six. I downloaded six and placed it in as well, and now I get:

'module' object has no attribute 'iterator'

In case anyone is interested - this is the code for doing this without pip:

from os import sys


sys.path.insert(0, "C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\Python\Python34\Lib\site-packages")

import six
import anytree

udo = anytree.Node("Udo")
print(udo)

Any ideas on how to fix this? Google only returned this result: __builtin__.iterator does not exist?

The only two options I can think of are - moving the folders physically (tried but given the error above) or installing through a script:

It doesn't seem to work either (on 2.7 and I tried an updated script on 3.6 but neither work).

import sys
import os
import site 
from importlib import reload

try:
   import pip
except ImportError:
   print "installing pip"
   cmd = "sudo easy_install pip"
   os.system(cmd)
   reload(site)

try: 
   import requests
except ImportError:
   print "no lib requests"
   import pip
   cmd = "sudo pip install requests"
   print "Requests package is missing\nPlease enter root password to install required package"
   os.system(cmd)
   reload(site)
3
  • 2
    Are you unable to use sudo apt install python-pip? Commented Aug 15, 2018 at 16:17
  • 1
    @CalebH. looks like it's windows. Commented Aug 15, 2018 at 16:32
  • @CalebH. This is windows and even still, I'm not allowed into the python terminal to execute pip or anything like that (the TestComplete IDE doesn't allow that) Commented Aug 15, 2018 at 16:40

1 Answer 1

1

I wrote something similar before and you are on the right track. Instead of

cmd = "sudo easy_install pip"

you need to try

cmd = "get-pip.py"

and have it point to the file you can download here https://bootstrap.pypa.io/get-pip.py.

Also, you can run pip from the command line in windows, no need to be in a python terminal. Like So:

pip install requests
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.