I want to run Sikuli for automating windows application using Python. I am new to Sikuli. Actually I have installed Sikuli by using pip install sikuli. And then I tried to import it in my Python file as given below:
from sikuli import *
print("Working")
but when i run it using 'python sikuliTest.py', I get the following error as given below:
Traceback (most recent call last):
File "sikuliTest.py", line 1, in <module>
from sikuli import *
File "c:\Python27\lib\site-packages\sikuli-0.1-py2.7- win32.egg\sikuli\__init__
.py", line 1, in <module>
from sikuli import *
File "c:\Python27\lib\site-packages\sikuli-0.1-py2.7- win32.egg\sikuli\sikuli.p
y", line 15, in <module>
from jnius import autoclass
File "d:\users\deepak-ra\appdata\local\temp\easy_install-4xytd2\jnius- 1.1.dev0
-py2.7-win32.egg.tmp\jnius\__init__.py", line 12, in <module>
File "d:\users\deepak-ra\appdata\local\temp\easy_install-4xytd2\jnius- 1.1.dev0
-py2.7-win32.egg.tmp\jnius\jnius.py", line 7, in <module>
File "d:\users\deepak-ra\appdata\local\temp\easy_install-4xytd2\jnius-1.1.dev0
-py2.7-win32.egg.tmp\jnius\jnius.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
Am not sure whether I had installed it correctly or where I have done the mistake. Please help me out with this.
Sikuli is using Jython and cannot be run directly from Python. If you want to use Python syntax to create scripts using Sikuli start reading here. Have a look at section 3 "How do I set up SikuliX".
For any specific questions/issues use the Sikuli Launchpad.
Related
I'm trying to create an exe out of my Python script. After a long journey of problem solving, I finally made it with Pyinstaller. I got a build folder, a dist folder, and the needed exe file.
Now, when I try to run the program, it doesn't work, although it does work in my IDE, PyCharm. If I just click on it, the cmd just opens for a ms and closes right away. If I start it via the cmd, it shows the error you can see below.
Normally there should be a main_window generated by my script, and like I said, it works when I start it from pycharm directly, so the code shouldn't be the problem.
I need the program on another PC without Pycharm at all, so I definitely need this exe file. I hope you can help me. Thanks in advance!
This is the error:
C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_>main_.exe
Traceback (most recent call last):
File "main_.py", line 7, in <module>
import torch
File "C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_\torch\__init__.py", line 643, in <module>
from .functional import * # noqa: F403
File "C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_\torch\functional.py", line 6, in <module>
import torch.nn.functional as F
File "C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_\torch\nn\__init__.py", line 1, in <module>
from .modules import * # noqa: F403
File "C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_\torch\nn\modules\__init__.py", line 2, in <module>
from .linear import Identity, Linear, Bilinear, LazyLinear
File "C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_\torch\nn\modules\linear.py", line 6, in <module>
from .. import functional as F
File "C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_\torch\nn\functional.py", line 11, in <module>
from .._jit_internal import boolean_dispatch, _overload, BroadcastingList1, BroadcastingList2, BroadcastingList3
File "C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_\torch\_jit_internal.py", line 28, in <module>
import torch.package._mangling as package_mangling
File "C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_\torch\package\__init__.py", line 11, in <module>
from .package_exporter import EmptyMatchError, PackageExporter, PackagingError
File "C:\Users\messlaptop\PycharmProjects\Source_code\dist\main_\torch\package\package_exporter.py", line 5, in <module>
import pickletools
ModuleNotFoundError: No module named 'pickletools'
[8896] Failed to execute script 'main_' due to unhandled exception!
I was trying to execute the following command on windows 10 machine using python 3.5.4,
from pywinauto.application import Application
Following is the error which i was receiving
Traceback (most recent call last):
File "C:/Users/bizact/Desktop/PSAV/test.py", line 1, in <module>
from pywinauto.application import Application
File "C:\Program Files\Python35\lib\site-packages\pywinauto\__init__.py", line 72, in <module>
from . import findwindows
File "C:\Program Files\Python35\lib\site-packages\pywinauto\findwindows.py", line 42, in <module>
from . import controls
File "C:\Program Files\Python35\lib\site-packages\pywinauto\controls\__init__.py", line 36, in <module>
from . import uiawrapper # register "uia" back-end (at the end of uiawrapper module)
File "C:\Program Files\Python35\lib\site-packages\pywinauto\controls\uiawrapper.py", line 46, in <module>
from ..uia_defines import IUIA
File "C:\Program Files\Python35\lib\site-packages\pywinauto\uia_defines.py", line 35, in <module>
import comtypes.client
File "C:\Program Files\Python35\lib\site-packages\comtypes\client\__init__.py", line 33, in <module>
gen_dir = _find_gen_dir()
File "C:\Program Files\Python35\lib\site-packages\comtypes\client\_code_cache.py", line 71, in _find_gen_dir
result = os.path.abspath(gen_path[-1])
IndexError: list index out of range
Is there a way i can fix this ?
Try running the script with administrative privileges. Just by looking at the traceback it looks like some cached files that pywinauto import tried to write but later on it wasn't found, and generally the script can't write the file due to permissions. If the above don't work, try installing python somewhere else (C:/Python with full privileges in order to isolate the issue)
This is comtypes issue. It will be fixed soon (EDIT: fixed in comtypes==1.1.7). You can downgrade to one of previous versions: pip install comtypes==1.1.2. Or run script as Administrator as Rodolfo suggested (disabling UAC may not help, need to say explicitly to "run as Administrator" by popup menu).
I would like to call a python function from C++ and get the return value. I've been able to do that with an easy multiply python function using this website's example code in section 5.3. To compile my program, I would run g++ test.cpp -I/usr/include/python2.7 -lpython2.7. However, the python function I want to run imports numpy. When I try to run my program that is similar to the one on the code example mentioned above, I get an "ImportError: cannot import name _remove_dead_weakref". The full error is here:
Traceback (most recent call last):
File "/home/osboxes/Desktop/test.py", line 1, in <module>
import numpy as np
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/core/__init__.py", line 74, in <module>
from numpy.testing.nosetester import _numpy_tester
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/testing/__init__.py", line 10, in <module>
from unittest import TestCase
File "/home/osboxes/miniconda2/lib/python2.7/unittest/__init__.py", line 64, in <module>
from .main import TestProgram, main
File "/home/osboxes/miniconda2/lib/python2.7/unittest/main.py", line 7, in <module>
from . import loader, runner
File "/home/osboxes/miniconda2/lib/python2.7/unittest/runner.py", line 7, in <module>
from .signals import registerResult
File "/home/osboxes/miniconda2/lib/python2.7/unittest/signals.py", line 2, in <module>
import weakref
File "/home/osboxes/miniconda2/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Some information: Python version is Python 2.7.14 :: Anaconda, Inc. (Is there a difference between python 2.7.14 and my version which has anaconda, inc. at the end?) The python program also runs just fine by itself. Any help would be appreciated. Thanks!
Edit: The path was being all weird with some parts going to my local python and numpy going to miniconda's python. Uninstalling miniconda as it wasn't needed for me fixed it.
This is happening because your environment is mixing two different Python installations. You can see it jump between them here:
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/testing/__init__.py"
File "/home/osboxes/miniconda2/lib/python2.7/unittest/__init__.py"
So you start out in /home/osboxes/.local/lib/python2.7/site-packages which is the Python installed by some system package manager (or perhaps even explicitly installed from source). But then it jumps to /home/osboxes/miniconda2/lib/python2.7 which is from Conda.
Since it appears you are intending to use Python from Conda, you need to install NumPy using Conda (so it is loaded from miniconda2 and not .local, and build your code using something like -I/home/osboxes/miniconda2/include/python2.7 instead of -I/usr/include/python2.7.
I am new to Python and am trying to use anaconda to do some data analysis. I am using Python 3.6.2 along with the geany text editor.
First, I'm trying to execute a file call panda.py which only contains import pandas as dp.
When I configure geany with a working directory of C:\Users\Anaconda3\python, I get the following error:
Traceback (most recent call last):
File "panda.py", line 1, in <module>
import pandas as dp
File "C:\Users\Anaconda3\lib\site-packages\pandas\__init__.py", line 13, in <module>
__import__(dependency)
File "C:\Users\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 35, in <module>
from . import _internal # for freeze programs
File "C:\Users\Anaconda3\lib\site-packages\numpy\core\_internal.py", line 18, in <module>
from .numerictypes import object_
File "C:\Users\Anaconda3\lib\site-packages\numpy\core\numerictypes.py", line 962, in <module>
_register_types()
File "C:\Users\Anaconda3\lib\site-packages\numpy\core\numerictypes.py", line 958, in _register_types
numbers.Integral.register(integer)
AttributeError: module 'numbers' has no attribute 'Integral'
The same error also occurs when I enter the following at the command prompt:
C:\Users\Anaconda3\python.exe C:\Users\Documents\python_work\panda.py
However, if I execute C:\Users\David\Anaconda3\python.exe and then enter import pandas as dp in the REPL, it appears to load without error.
Any idea how I can fix this so I can use anaconda with geany?
[SOLVED] John below ask if I had a file called numbers.py in my directory which made me realize I named an exercise I previously did as numbers.py. Once I removed it, the error went away (I tested it further by adding a file with the name again and the error returned).
I'm new to the stack over flow community. Let me know if there's anything else I need to do to close out this question.
Also thanks to chb for the edits to my original question the format looks much easier to read.
Disclaimer: python on windows is not something I know about
You know that C:\Users\David\Anaconda3\python.exe when run standalone knows how to import pandas, so your setup is fine - you have everything installed that you need, and in the correct locations.
Given that, you can look at two issues: gearny setup, and general setup. I noticed that python and pandas is installed under C:\Users\Anaconda3, while your program is under C:\Users\Documents\python_work, and we also have C:\Users\David - could it be permissions issues?
I just got Panda3D for the first time. I deleted the included Python version. In my Python dir, I put a file panda.pth that looks like this:
C:\Panda3D-1.6.2
C:\Panda3D-1.6.2\bin
But when I run import direct.directbase.DirectStart, I get:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import direct.directbase.DirectStart
File "C:\Panda3D-1.6.2\direct\directbase\DirectStart.py", line 3, in <module>
from direct.showbase import ShowBase
File "C:\Panda3D-1.6.2\direct\showbase\ShowBase.py", line 10, in <module>
from pandac.PandaModules import *
File "C:\Panda3D-1.6.2\pandac\PandaModules.py", line 1, in <module>
from libpandaexpressModules import *
File "C:\Panda3D-1.6.2\pandac\libpandaexpressModules.py", line 1, in <module>
from extension_native_helpers import *
File "C:\Panda3D-1.6.2\pandac\extension_native_helpers.py", line 75, in <module>
Dtool_PreloadDLL("libpandaexpress")
File "C:\Panda3D-1.6.2\pandac\extension_native_helpers.py", line 73, in Dtool_PreloadDLL
imp.load_dynamic(module, pathname)
ImportError: Module use of python25.dll conflicts with this version of Python.
I'm assuming this has something to do with me using Python 2.6. Any solutions?
Python extensions aren't binary compatible across major releases. Your options are:
A. Recompile panda3d for python 2.6.
B. Use python 2.5.
No way around it.
If you can wait for the upcoming 1.7.0 release, it will be compiled against Python 2.6 - see this thread.