Giter VIP home page Giter VIP logo

Comments (7)

Meteorix avatar Meteorix commented on May 10, 2024

@kagamimoe 你好,poco可以先回退一个版本试试pip install -U pocoui=1.0.56

from poco.

Meteorix avatar Meteorix commented on May 10, 2024

可以尝试在启动游戏之后初始化poco:


class test002(unittest.TestCase):

    def setUp(self):
        print "开始启动游戏"
        normal_start()
        self.poco = StdPoco(15004, device)

from poco.

kagamimoe avatar kagamimoe commented on May 10, 2024

@Meteorix poco回退到 1.0.56版本后 报另一个错误

Traceback (most recent call last):
  File "D:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.6\helpers\pycharm\utrunner.py", line 116, in <module>
    modules = [loadSource(a[0])]
  File "D:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.6\helpers\pycharm\utrunner.py", line 40, in loadSource
    module = imp.load_source(moduleName, fileName)
  File "C:\sgame\scripts\test002.py", line 12, in <module>
    from lib.common import normal_start,normal_exit,pic_dir_setting,return_panel,pic_dir
  File "C:\sgame\lib\common.py", line 16, in <module>
    poco = StdPoco(15004, device)
  File "C:\Python27\lib\site-packages\poco\drivers\std\__init__.py", line 93, in __init__
    agent = StdPocoAgent((ip, port))
  File "C:\Python27\lib\site-packages\poco\drivers\std\__init__.py", line 28, in __init__
    self.c.connect()
  File "C:\Python27\lib\site-packages\poco\utils\simplerpc\rpcclient.py", line 23, in connect
    self._wait_connected(timeout)
  File "C:\Python27\lib\site-packages\poco\utils\simplerpc\rpcclient.py", line 37, in _wait_connected
    raise RpcConnectionError("Rpc Connection Closed")
poco.utils.simplerpc.simplerpc.RpcConnectionError: Rpc Connection Closed
[10:48:19][DEBUG]<airtest.core.android.adb> C:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s ce12160cc43a001f0c forward --remove tcp:19378

from poco.

kagamimoe avatar kagamimoe commented on May 10, 2024

启动游戏之后初始化poco的话, 那在其他方法里怎么调用poco呢

提示这个错误:

Error
Traceback (most recent call last):
  File "C:\sgame\scripts\test002.py", line 31, in test_change_name
    if poco("imgHead").exists:
NameError: global name 'poco' is not defined

from poco.

Meteorix avatar Meteorix commented on May 10, 2024

这样你就可以 self.poco("imgHead").exists:

from poco.

Meteorix avatar Meteorix commented on May 10, 2024

或者你可以把poco设置为全局变量

poco = None

class test002(unittest.TestCase):

    def setUp(self):
        print "开始启动游戏"
        normal_start()
        global poco
        poco = StdPoco(15004, device)

from poco.

kagamimoe avatar kagamimoe commented on May 10, 2024

声明为全局变量后可以跑了。谢谢大佬

from poco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.