Please use https://github.com/autopilot-rs/autopy instead.
autopilot-rs / autopy-legacy Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED: Replaced by https://github.com/autopilot-rs/autopy
License: Other
DEPRECATED: Replaced by https://github.com/autopilot-rs/autopy
License: Other
Please use https://github.com/autopilot-rs/autopy instead.
if i pass a string containing non-ascii chars (like "éèçà" and their friends) only the ascii characters are typed, seems toggleUniKey() in keypress.c converst to unsigned char, so there is no unicode support whatsoever, is it possible to find a fix for that?
bitmap.capture_screen capture on OSX 10.7 cause black screen
The coordinates of bitmaps found are always off by one in x and y direction,
best illustrated by the following code:
ARROW = autopy.bitmap.Bitmap.open("arrows.png")
print ARROW.find_bitmap(ARROW)
results in (1,1) instead of the expected (0,0) possibly due to
findBitmapInRectAt, which does 8ofr an unknown reason)
increment the point offset before return:
if (needleAtOffset(needle, haystack, pointOffset, tolerance)) {
++pointOffset.x;
++pointOffset.y;
*point = pointOffset;
return 0;
this has the additional side effect, that the find all bitmaps code does not work properly since it does not find identical bitmaps with the same y coordinate because it starts looking at the coordinates returned by the code above.
Would be very useful write code like this
screen.focus("Firefox")
name = screen.getNameByPos(100, 150)
screen.focus(name)
A more proper version format should be used in setup.py
, similar with the ones mentioned (recommended) by PEP 386. For example 0.43b2
.
Hi, I'm trying to install it but returns a lot of warnings/errors:
src/screengrab.c:48:26: warning: implicit declaration of function 'CGDisplayBitsPerPixel' is invalid in C99
[-Wimplicit-function-declaration]
bitsPerPixel = (uint8_t)CGDisplayBitsPerPixel(displayID);
^
src/screengrab.c:174:15: warning: 'kCGLPFAFullScreen' is deprecated: first deprecated in OS X 10.6 [-Wdeprecated-declarations]
attribs[0] = kCGLPFAFullScreen;
^
/System/Library/Frameworks/OpenGL.framework/Headers/CGLTypes.h:71:2: note: 'kCGLPFAFullScreen' has been explicitly marked deprecated
here
kCGLPFAFullScreen OPENGL_ENUM_DEPRECATED(10_0, 10_6) = 54,
^
src/screengrab.c:191:2: warning: 'CGLSetFullScreen' is deprecated: first deprecated in OS X 10.6 [-Wdeprecated-declarations]
CGLSetFullScreen(glContext);
^
/System/Library/Frameworks/OpenGL.framework/Headers/OpenGL.h:73:17: note: 'CGLSetFullScreen' has been explicitly marked deprecated
here
extern CGLError CGLSetFullScreen(CGLContextObj ctx) OPENGL_DEPRECATED(10_0, 10_6);
^
src/screengrab.c:194:2: warning: implicit declaration of function 'glReadBuffer' is invalid in C99 [-Wimplicit-function-declaration]
glReadBuffer(GL_FRONT);
^
src/screengrab.c:194:15: error: use of undeclared identifier 'GL_FRONT'
glReadBuffer(GL_FRONT);
^
src/screengrab.c:197:2: warning: implicit declaration of function 'glFinish' is invalid in C99 [-Wimplicit-function-declaration]
glFinish();
^
src/screengrab.c:199:6: warning: implicit declaration of function 'glGetError' is invalid in C99 [-Wimplicit-function-declaration]
if (glGetError() != GL_NO_ERROR) return NULL;
^
src/screengrab.c:199:22: error: use of undeclared identifier 'GL_NO_ERROR'
if (glGetError() != GL_NO_ERROR) return NULL;
^
src/screengrab.c:207:2: warning: implicit declaration of function 'glPopClientAttrib' is invalid in C99
[-Wimplicit-function-declaration]
glPopClientAttrib(); /* Clear attributes previously set. /
^
src/screengrab.c:223:2: warning: implicit declaration of function 'glPushClientAttrib' is invalid in C99
[-Wimplicit-function-declaration]
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
^
src/screengrab.c:223:21: error: use of undeclared identifier 'GL_CLIENT_PIXEL_STORE_BIT'
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
^
src/screengrab.c:225:2: warning: implicit declaration of function 'glPixelStorei' is invalid in C99 [-Wimplicit-function-declaration]
glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); / Force alignment. /
^
src/screengrab.c:225:16: error: use of undeclared identifier 'GL_PACK_ALIGNMENT'
glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); / Force alignment. */
^
src/screengrab.c:226:16: error: use of undeclared identifier 'GL_PACK_ROW_LENGTH'
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
^
src/screengrab.c:227:16: error: use of undeclared identifier 'GL_PACK_SKIP_ROWS'
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
^
src/screengrab.c:228:16: error: use of undeclared identifier 'GL_PACK_SKIP_PIXELS'
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
^
src/screengrab.c:235:2: warning: implicit declaration of function 'glReadPixels' is invalid in C99 [-Wimplicit-function-declaration]
glReadPixels(x, y, width, height,
^
src/screengrab.c:236:30: error: use of undeclared identifier 'GL_BGRA'
MMRGB_IS_BGR ? GL_BGRA : GL_RGBA,
^
src/screengrab.c:236:40: error: use of undeclared identifier 'GL_RGBA'
MMRGB_IS_BGR ? GL_BGRA : GL_RGBA,
what should I do?
I'd really love for my autopy
scripts to be run under Python 3 instead of Python 2. If autopy
could support Python 3, that's be great.
Hi,
If two or more bitmaps u are searching for are on the same row, find_all_bitmaps will only find one.
Fix:
//++pointOffset.x;
//++pointOffset.y;
in bitmap_find.c
Cheers!
When I try to use Autopy to move the mouse to any monitor except my primary, I get "ValueError: Point out of bounds:.
Is Autopy able to move the mouse to multiple monitors?
When trying to use the bitmap.capture_screen() function, I'm getting this error and it crashes:
This application has requested the runtime to terminate it in an unusual way please contact the application's support
The screen grab still works though and it saves ok.
Setup: Win7/Python 2.5/MinGW
Hi all, and thanks again for the time and brain power dedicated towards this project!
Now that I've pulled a more recent update, I noticed that another cast conversion warning/error exists in keycode.c.
error: invalid conversion from ‘void*’ to ‘const __CFData*’
I believe that this should be rectified with the following.
(CFDataRef) TISGetInputSourceProperty(currentKeyboard,
Error:
>>> import autopy
Traceback (most recent call last):
File "", line 1, in
File "autopy/init.py", line 7, in
import autopy.alert
ImportError: No module named alert
It would be nice to convert autopy into pure python package.
Advantages:
Disadvantages:
C implementation can be an alternative as cAutopy (like Pickle/cPickle).
Mouse control has already a pure Python implementation in PyMouse (https://github.com/pepijndevos/PyMouse),
this would be very easy to integrate.
PyMouse has an additional backend: Java
For the documentation:
on Ubuntu libxtst-dev is a dependency.
I'd like to request a function to control the media player, since python is missing this.
It could be implemented sending keystrokes to the player process.
Whenever I try to make a screen capture of a specific region I get a black bitmap.
It looks like rect = ((100,100),(100,200)) does not work properly.
Instead of going 100x,100y into the screen it goes backward i.e. the 100,100 is -100,-100.
But when I enter -100,-100 I get a "out of bound" error.
Im trying to detect the color at at special point, however trying to use screen.get_color(x,y) just returns a 0 when i was expecting a hexidecimal, is there a fix for this?
I get this error when trying to build it. I've tried it on both a Windows 7 and 8 machine. Both 64bit. It's the same error as issue 24 #24 but I tried installing Visual Studio 2008 Express and it didn't help.
gcc: error: user32.lib: No such file or directory
gcc: error: Gdi32.lib: No such file or directory
D:\Software Development\Anaconda\Scripts\dllwrap.bat....\MinGW\bin\dllwrap.exe: D:\Software Development\Anaconda\Scripts\dllwrap.bat....\MinGW\bin\gcc exited with status 1
This package/module runs into an issue with the 'gcc' compiler on mac OSX that's running Anaconda.
Here's the error output (while trying to use "pip" -- it's also true for "setup.py install" and "easy_install autopy"
//anaconda/bin/pip run on Thu Sep 25 20:00:39 2014
Downloading/unpacking autopy
Getting page https://pypi.python.org/simple/autopy/
URLs to search for versions for autopy:
* https://pypi.python.org/simple/autopy/
Analyzing links from page https://pypi.python.org/simple/autopy/
Skipping link https://pypi.python.org/packages/2.7/a/autopy/autopy-0.5.win-amd64-py2.7.exe#md5=3b5c85ecb43f89c0f28f2e5ff8771df0 (from https://pypi.python.org/simple/autopy/); unknown archive format: .exe
Skipping link https://pypi.python.org/packages/2.7/a/autopy/autopy-0.5.win32-py2.7.exe#md5=0f08da102b2826200e2675f7bec510d6 (from https://pypi.python.org/simple/autopy/); unknown archive format: .exe
Skipping link https://pypi.python.org/packages/2.7/a/autopy/autopy-0.51.win-amd64-py2.7.exe#md5=f67dee6f0a30673a2b267dec0431395e (from https://pypi.python.org/simple/autopy/); unknown archive format: .exe
Skipping link https://pypi.python.org/packages/2.7/a/autopy/autopy-0.51.win32-py2.7.exe#md5=93e91799367e9207383747a633408185 (from https://pypi.python.org/simple/autopy/); unknown archive format: .exe
Found link https://pypi.python.org/packages/source/a/autopy/autopy-0.5.tar.gz#md5=723d2b15704b47573f83302c3788b0fc (from https://pypi.python.org/simple/autopy/), version: 0.5
Found link https://pypi.python.org/packages/source/a/autopy/autopy-0.51.tar.gz#md5=b92055aa2a3712a9c3b4c874014b450e (from https://pypi.python.org/simple/autopy/), version: 0.51
Skipping link https://github.com/msanders/autopy/ (from https://pypi.python.org/simple/autopy/); not a file
Using version 0.51 (newest of versions: 0.51, 0.5)
Downloading from URL https://pypi.python.org/packages/source/a/autopy/autopy-0.51.tar.gz#md5=b92055aa2a3712a9c3b4c874014b450e (from https://pypi.python.org/simple/autopy/)
Running setup.py (path:/private/var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip_build_douglasmccormickjr/autopy/setup.py) egg_info for package autopy
running egg_info
creating pip-egg-info/autopy.egg-info
writing pip-egg-info/autopy.egg-info/PKG-INFO
writing top-level names to pip-egg-info/autopy.egg-info/top_level.txt
writing dependency_links to pip-egg-info/autopy.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/autopy.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pip-egg-info/autopy.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pip-egg-info/autopy.egg-info/SOURCES.txt'
Source in /private/var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip_build_douglasmccormickjr/autopy has version 0.51, which satisfies requirement autopy
Installing collected packages: autopy
Running setup.py install for autopy
Running command //anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip_build_douglasmccormickjr/autopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip-YyQjHI-record/install-record.txt --single-version-externally-managed --compile
running install
running build
running build_py
creating build
creating build/lib.macosx-10.5-x86_64-2.7
creating build/lib.macosx-10.5-x86_64-2.7/autopy
copying autopy/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/autopy
running build_ext
building 'color' extension
creating build/temp.macosx-10.5-x86_64-2.7
creating build/temp.macosx-10.5-x86_64-2.7/src
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/autopy-color-module.c -o build/temp.macosx-10.5-x86_64-2.7/src/autopy-color-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/MMBitmap.c -o build/temp.macosx-10.5-x86_64-2.7/src/MMBitmap.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc -bundle -undefined dynamic_lookup -L//anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/src/autopy-color-module.o build/temp.macosx-10.5-x86_64-2.7/src/MMBitmap.o -L//anaconda/lib -o build/lib.macosx-10.5-x86_64-2.7/autopy/color.so
building 'screen' extension
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/autopy-screen-module.c -o build/temp.macosx-10.5-x86_64-2.7/src/autopy-screen-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/screen.c -o build/temp.macosx-10.5-x86_64-2.7/src/screen.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/screengrab.c -o build/temp.macosx-10.5-x86_64-2.7/src/screengrab.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
src/screengrab.c:48:26: warning: implicit declaration of function 'CGDisplayBitsPerPixel' is invalid in C99 [-Wimplicit-function-declaration]
bitsPerPixel = (uint8_t)CGDisplayBitsPerPixel(displayID);
^
src/screengrab.c:194:2: warning: implicit declaration of function 'glReadBuffer' is invalid in C99 [-Wimplicit-function-declaration]
glReadBuffer(GL_FRONT);
^
src/screengrab.c:194:15: error: use of undeclared identifier 'GL_FRONT'
glReadBuffer(GL_FRONT);
^
src/screengrab.c:197:2: warning: implicit declaration of function 'glFinish' is invalid in C99 [-Wimplicit-function-declaration]
glFinish();
^
src/screengrab.c:199:6: warning: implicit declaration of function 'glGetError' is invalid in C99 [-Wimplicit-function-declaration]
if (glGetError() != GL_NO_ERROR) return NULL;
^
src/screengrab.c:199:22: error: use of undeclared identifier 'GL_NO_ERROR'
if (glGetError() != GL_NO_ERROR) return NULL;
^
src/screengrab.c:207:2: warning: implicit declaration of function 'glPopClientAttrib' is invalid in C99 [-Wimplicit-function-declaration]
glPopClientAttrib(); /* Clear attributes previously set. */
^
src/screengrab.c:223:2: warning: implicit declaration of function 'glPushClientAttrib' is invalid in C99 [-Wimplicit-function-declaration]
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
^
src/screengrab.c:223:21: error: use of undeclared identifier 'GL_CLIENT_PIXEL_STORE_BIT'
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
^
src/screengrab.c:225:2: warning: implicit declaration of function 'glPixelStorei' is invalid in C99 [-Wimplicit-function-declaration]
glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); /* Force alignment. */
^
src/screengrab.c:225:16: error: use of undeclared identifier 'GL_PACK_ALIGNMENT'
glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); /* Force alignment. */
^
src/screengrab.c:226:16: error: use of undeclared identifier 'GL_PACK_ROW_LENGTH'
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
^
src/screengrab.c:227:16: error: use of undeclared identifier 'GL_PACK_SKIP_ROWS'
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
^
src/screengrab.c:228:16: error: use of undeclared identifier 'GL_PACK_SKIP_PIXELS'
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
^
src/screengrab.c:235:2: warning: implicit declaration of function 'glReadPixels' is invalid in C99 [-Wimplicit-function-declaration]
glReadPixels(x, y, width, height,
^
src/screengrab.c:236:30: error: use of undeclared identifier 'GL_BGRA'
MMRGB_IS_BGR ? GL_BGRA : GL_RGBA,
^
src/screengrab.c:236:40: error: use of undeclared identifier 'GL_RGBA'
MMRGB_IS_BGR ? GL_BGRA : GL_RGBA,
^
8 warnings and 9 errors generated.
error: command 'gcc' failed with exit status 1
Complete output from command //anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip_build_douglasmccormickjr/autopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip-YyQjHI-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.5-x86_64-2.7
creating build/lib.macosx-10.5-x86_64-2.7/autopy
copying autopy/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/autopy
running build_ext
building 'color' extension
creating build/temp.macosx-10.5-x86_64-2.7
creating build/temp.macosx-10.5-x86_64-2.7/src
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/autopy-color-module.c -o build/temp.macosx-10.5-x86_64-2.7/src/autopy-color-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/MMBitmap.c -o build/temp.macosx-10.5-x86_64-2.7/src/MMBitmap.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc -bundle -undefined dynamic_lookup -L//anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/src/autopy-color-module.o build/temp.macosx-10.5-x86_64-2.7/src/MMBitmap.o -L//anaconda/lib -o build/lib.macosx-10.5-x86_64-2.7/autopy/color.so
building 'screen' extension
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/autopy-screen-module.c -o build/temp.macosx-10.5-x86_64-2.7/src/autopy-screen-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/screen.c -o build/temp.macosx-10.5-x86_64-2.7/src/screen.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I//anaconda/include/python2.7 -c src/screengrab.c -o build/temp.macosx-10.5-x86_64-2.7/src/screengrab.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
src/screengrab.c:48:26: warning: implicit declaration of function 'CGDisplayBitsPerPixel' is invalid in C99 [-Wimplicit-function-declaration]
bitsPerPixel = (uint8_t)CGDisplayBitsPerPixel(displayID);
^
src/screengrab.c:194:2: warning: implicit declaration of function 'glReadBuffer' is invalid in C99 [-Wimplicit-function-declaration]
glReadBuffer(GL_FRONT);
^
src/screengrab.c:194:15: error: use of undeclared identifier 'GL_FRONT'
glReadBuffer(GL_FRONT);
^
src/screengrab.c:197:2: warning: implicit declaration of function 'glFinish' is invalid in C99 [-Wimplicit-function-declaration]
glFinish();
^
src/screengrab.c:199:6: warning: implicit declaration of function 'glGetError' is invalid in C99 [-Wimplicit-function-declaration]
if (glGetError() != GL_NO_ERROR) return NULL;
^
src/screengrab.c:199:22: error: use of undeclared identifier 'GL_NO_ERROR'
if (glGetError() != GL_NO_ERROR) return NULL;
^
src/screengrab.c:207:2: warning: implicit declaration of function 'glPopClientAttrib' is invalid in C99 [-Wimplicit-function-declaration]
glPopClientAttrib(); /* Clear attributes previously set. */
^
src/screengrab.c:223:2: warning: implicit declaration of function 'glPushClientAttrib' is invalid in C99 [-Wimplicit-function-declaration]
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
^
src/screengrab.c:223:21: error: use of undeclared identifier 'GL_CLIENT_PIXEL_STORE_BIT'
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
^
src/screengrab.c:225:2: warning: implicit declaration of function 'glPixelStorei' is invalid in C99 [-Wimplicit-function-declaration]
glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); /* Force alignment. */
^
src/screengrab.c:225:16: error: use of undeclared identifier 'GL_PACK_ALIGNMENT'
glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); /* Force alignment. */
^
src/screengrab.c:226:16: error: use of undeclared identifier 'GL_PACK_ROW_LENGTH'
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
^
src/screengrab.c:227:16: error: use of undeclared identifier 'GL_PACK_SKIP_ROWS'
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
^
src/screengrab.c:228:16: error: use of undeclared identifier 'GL_PACK_SKIP_PIXELS'
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
^
src/screengrab.c:235:2: warning: implicit declaration of function 'glReadPixels' is invalid in C99 [-Wimplicit-function-declaration]
glReadPixels(x, y, width, height,
^
src/screengrab.c:236:30: error: use of undeclared identifier 'GL_BGRA'
MMRGB_IS_BGR ? GL_BGRA : GL_RGBA,
^
src/screengrab.c:236:40: error: use of undeclared identifier 'GL_RGBA'
MMRGB_IS_BGR ? GL_BGRA : GL_RGBA,
^
8 warnings and 9 errors generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Removing temporary dir /private/var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip_build_douglasmccormickjr...
Command //anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip_build_douglasmccormickjr/autopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip-YyQjHI-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip_build_douglasmccormickjr/autopy
Exception information:
Traceback (most recent call last):
File "//anaconda/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "//anaconda/lib/python2.7/site-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "//anaconda/lib/python2.7/site-packages/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "//anaconda/lib/python2.7/site-packages/pip/req.py", line 706, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "//anaconda/lib/python2.7/site-packages/pip/util.py", line 697, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command //anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip_build_douglasmccormickjr/autopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip-YyQjHI-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/ld/yd6tjvlx11ggk54f1w28xzy00000gn/T/pip_build_douglasmccormickjr/autopy
---END---
I hope that helps.
Thanks,
-Doug Jr.
Hello, is it possible to change this line in deadbeef_rand.c to:
return (t << 24) ^ (c << 11) ^ t ^ (unsigned long) &c;
This will avoid the following warning (in c, or error when compiled in c++) on machines where the addresses are longer than 32 bits.
warning: cast from pointer to integer of different size
I've run the installer on Windows XP (32 bit) with Python 2.6.1. I opened up a Python console to give it a try and I received this:
>>> import pydroid
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\site-packages\pydroid\__init__.py", line 8, in <module>
import pydroid.bitmap
ImportError: DLL load failed: This application has failed to start because the a
pplication configuration is incorrect. Reinstalling the application may fix this
problem.
>>>
Sometimes mouse.smooth_move gives:
ValueError: Point out of bounds
Just try to move the cursor in different position and use this function in order to see the problem.
When setting mouse position in another screen ValueError: Point out of bounds happens.
>>> a
<Bitmap object at 0x7f38d92c02d8>
>>> autopy.bitmap.Bitmap.from_string(a.to_string())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Could not create bitmap from string: Error decoding string
I can't visit the official site
from PIL import Image
possible add following api for rect compare using native autopy instead PIL
def compare_rect((ax,ay),bmp_name):
im=Image.open(bmp_name)
rect = ((ax-1,ay-1),(im.size[0]+2,im.size[1]+2))
tst = bitmap.Bitmap.open(bmp_name)
scr = bitmap.capture_screen(rect)
pos = scr.find_bitmap(tst)
if pos:
return 1
else:
return 0
autopy.mouse.move does not move to the correct position on the windows platform due to rounding errors. The problem are the following lines in src/mouse.c:
point.x *= 0xFFFF / GetSystemMetrics(SM_CXSCREEN);
point.y *= 0xFFFF / GetSystemMetrics(SM_CYSCREEN);
because if I want to move to (2000, 10) (I have two joined screens which gives a total res of 2560x1024),
it calculates for the x-coordinate 0xFFFF/2560 = 25 and then 2000 * 25 = 50000 while the correct result is
2000 * 0xFFFF / 2560 = 51199. This gives as a result a x-position of 50000 * 2560 / 0xFFF = 1953 (47 pixels off).
A workaround is to use ctypes.windll.user32.SetCursorPos(2000,10) which is not equivalent (http://stackoverflow.com/questions/3720938/win32-moving-mouse-with-setcursorpos-vs-mouse-event) but may help in some cases.
I've taken a screenshot, saved it as a png, then clipped part of it (which the library really should allow.), now autopy cannot find the clipped version in the larger image. What's the deal?
I'm using GIMP to edit the images, and loading both back in, via Bitmap.open()
I have write a mouse control script by autopy module ,and it works well.But when I want to stop the script ,the problem is appear. I can't get the mouse focus ! when I move the mouse cursor,it will quickly return the before position.
Now I have to use shortcut key to launch a terminal to use command ps -aux | grep script.py
to get the script pid_num and use kill pid_num
to terminated the script. In addition,when the autopy script running the C-c
is doesn't works.
So how can I stop this script ! Is there a elegant sulution ?
(Sorry for the bad English)
Hello msanders,
first of all thanks for this library. I think it has the best API I've ever seen!
Unfortunately some essential thinks in the module "key" doesn't seem to work on my system (Ubuntu).
I've written an test script with comments in it to show you what I mean (appended after the PS).
I'm using a german keyboard layout / os, could this be a problem?
Do you see the same behavior as described in my script?
If yes: Do you think the problem is easy to fix?
I would love to use your library, sadly I don't know C, so I can't debug this myself.
Best regard,
Daniel
PS: here is the test script:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from autopy import key as k
import subprocess
import time
TAB = 65289
def main( ):
test_typing( )
alt_tab_test( )
def test_typing( ):
"""
typing a string doesn't works. Some chars are ignored (key.type_string) or
the false character is written (line 24, 25)
"""
string = "123456789!§$%&/()=?¹²³¼½¬{[]}\ "
p = subprocess.Popen( "gedit", shell=True )
time.sleep( 2 )
# bad => "123456789134567()0ß1234567890ß ":
for char in string:
k.tap( ord( char ) )
# worse => "123456789":
#k.type_string( string )
def alt_tab_test( ):
"""
modifiers don't seem to work. But it is easy to work around.
"""
# works:
k.toggle( k.K_ALT, True )
k.tap( TAB )
k.toggle( k.K_ALT, False )
# failed with: Segmentation fault
k.tap( TAB, k.MOD_ALT )
if __name__ == "__main__":
main( )
I hope this is quicker than forking/submitting a patch
please add TAB to the list of keys supported by autopy
keycode.h: K_TAB = kVK_Tab
keycode.h: K_TAB = XK_Tab
keycode.h: K_TAB = VK_TAB
autopy-key-module.c: PyModule_AddIntMacro(mod, K_TAB) < 0 ||
The code doesn't properly compile on OS X 10.8 (and possibly others?).
It fails with GL_RGBA being undefined.
Add the following to src/screengrab.c's OS X includes:
I am still seeing compile errors, but this gets me past that one.
There seems to be no activity in the original github project for the last 3 years. Looking into the fork overview I see about a dozen of unmerged forks. There are 5 open pull request which look like serious fixes.
Does anyone here have an overview over the project status? I would like to see a version of autopy including all those fixes as well as a Python 3 port. Is anyone here working on that target yet?
E.g., the output of the following should be 'A':
key.toggle(key.K_SHIFT, True)
key.tap('a')
key.toggle(key.K_SHIFT, False)
But on OS X, it is merely 'a'.
This appears to be a bug with CGEventCreateKeyboardEvent(); see: http://lists.apple.com/archives/quartz-dev/2009/Dec/msg00067.html
Is there an alternative (Carbon, maybe?) function we can use in the meantime?
The python code depends on calls to functions in the shared libraries that are compiled as inline functions. These functions need to either not be called outside of the C code, or need to be compiled in to the libraries as functions, rather than inlined into other functions.
Under Win 7 x64, using Cygwin x64 v 1.7.32, gcc 4.8.3 and python 2.7.8
One gets, while doing "pip -v install autopy"
**** error dump start ****
gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.8-1.x86_64/build=/usr/src/debug/python-2.7.8-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.8-1.x86_64/src/Python-2.7.8=/usr/src/debug/python-2.7.8-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DUSE_X11 -I/usr/include/python2.7 -c src/alert.c -o build/temp.cygwin-1.7.32-x86_64-2.7/src/alert.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
In file included from src/alert.c:13:0:
src/snprintf.h:34:12: error: conflicting types for ‘asnprintf’
extern int asnprintf (char ptr, size_t str_m, const char _fmt, /args/ ...);
^
In file included from /usr/include/assert.h:9:0,
from src/alert.c:3:
/usr/include/stdio.h:247:8: note: previous declaration of ‘asnprintf’ was here
char * _EXFUN(asnprintf, (char *__restrict, size_t *__restrict, const char *__restrict, ...)
^
In file included from src/alert.c:13:0:
src/snprintf.h:35:12: error: conflicting types for ‘vasnprintf’
extern int vasnprintf(char *_ptr, size_t str_m, const char _fmt, va_list ap);
^
In file included from /usr/include/assert.h:9:0,
from src/alert.c:3:
/usr/include/stdio.h:275:8: note: previous declaration of ‘vasnprintf’ was here
char * EXFUN(vasnprintf, (char *, size_t *, const char *, __VALIST)
^
error: command 'gcc' failed with exit status 1
** error dump ends ****
Commenting-out lines 34 and 35 of src/snprintf.h seems to do the trick:
//extern int asnprintf (char *_ptr, size_t str_m, const char *fmt, /args/ ...);
//extern int vasnprintf(char *_ptr, size_t str_m, const char *fmt, va_list ap);
Compiling is successful afterwards.
Perhaps there's a deeper issue that someone here might get a grasp of.
"alert" doesn't work with unicode, but with current local encoding:
running python2.7.3, 64bit, from PythonWin,
autopy.alert.alert("thmhe איציק") # img 1
True
autopy.alert.alert(title=u"Hello, איציק", msg="string from pythonwin")
Traceback (most recent call last):
File "", line 1, in
UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-11: ordinal not in range(128)
... (tried all kinds of unicode/utf - all gives errors) ...
Last test, non-unicode encoding, img 2:
autopy.alert.alert(title=s.encode('cp1255'), msg="string from pythonwin")
True
Hi, I checked the site http://pypi.python.org/pypi/autopy/ , and didn't find any windows installer for py2.6
so I want to build it by myself.
however I got some error, please see the below info.
Could anyone please help me? thanks.
D:\msanders-autopy-38e5ecc>setup.py build
running build
running build_py
running build_ext
building 'screen' extension
writing build\temp.win32-2.6\Release\src\screen.def
C:\Program Files\CodeBlocks\MinGW\bin\dllwrap.exe -mno-cygwin -mdll -static --en
try _DllMain@12 --output-lib build\temp.win32-2.6\Release\src\libscreen.a --def
build\temp.win32-2.6\Release\src\screen.def -s build\temp.win32-2.6\Release\src
autopy-screen-module.o build\temp.win32-2.6\Release\src\screen.o build\temp.win3
2-2.6\Release\src\screengrab.o build\temp.win32-2.6\Release\src\mmbitmap.o -LD:
msanders-autopy-38e5ecc\windows\win32 -LC:\Python26\libs -LC:\Python26\PCbuild -
luser32 -lGdi32 -lpython26 -lmsvcr90 -o build\lib.win32-2.6\autopy\screen.pyd us
er32.lib Gdi32.lib
gcc: user32.lib: No such file or directory
gcc: Gdi32.lib: No such file or directory
dllwrap: gcc exited with status 1
error: command 'dllwrap' failed with exit status 1
Fails with pip and easy_install...
Xcode4.0.2 present
OSX 10.6.8
it tries to compile against 10.3 for some reason =\
MyBook-2:~ polzovatel$ easy_install autopy Searching for autopy Reading http://pypi.python.org/simple/autopy/ Reading http://www.autopy.org Best match: autopy 0.51 Downloading http://pypi.python.org/packages/source/a/autopy/autopy-0.51.tar.gz#md5=b92055aa2a3712a9c3b4c874014b450e Processing autopy-0.51.tar.gz Running autopy-0.51/setup.py -q bdist_egg --dist-dir /var/folders/ha/ha8sLf91GXWORhWgw0ZW5k+++TI/-Tmp-/easy_install-lBQ9UR/autopy-0.51/egg-dist-tmp-TU3lqu unable to execute gcc-4.0: No such file or directory error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1tried to export CC and switched to pip (someone said easy_install was deprecated)
MyBook-2:~ polzovatel$ export CC=gcc-4.2
MyBook-2:Downloads polzovatel$ pip install autopy
Downloading/unpacking autopy
Downloading autopy-0.51.tar.gz (74Kb): 74Kb downloaded
Running setup.py egg_info for package autopy
Installing collected packages: autopy
Running setup.py install for autopy
building 'color' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/autopy-color-module.c -o build/temp.macosx-10.3-intel-2.7/src/autopy-color-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,
from src/autopy-color-module.h:5,
from src/autopy-color-module.c:1:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,
from src/autopy-color-module.h:5,
from src/autopy-color-module.c:1:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/MMBitmap.c -o build/temp.macosx-10.3-intel-2.7/src/MMBitmap.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc-4.0 -g -bundle -undefined dynamic_lookup -g -arch i386 -arch x86_64 build/temp.macosx-10.3-intel-2.7/src/autopy-color-module.o build/temp.macosx-10.3-intel-2.7/src/MMBitmap.o -o build/lib.macosx-10.3-intel-2.7/autopy/color.so
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;file='/Users/polzovatel/Downloads/build/autopy/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /var/folders/ha/ha8sLf91GXWORhWgw0ZW5k+++TI/-Tmp-/pip-NmBXbk-record/install-record.txt:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.3-intel-2.7
creating build/lib.macosx-10.3-intel-2.7/autopy
copying autopy/init.py -> build/lib.macosx-10.3-intel-2.7/autopy
running build_ext
building 'color' extension
creating build/temp.macosx-10.3-intel-2.7
creating build/temp.macosx-10.3-intel-2.7/src
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/autopy-color-module.c -o build/temp.macosx-10.3-intel-2.7/src/autopy-color-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,
from src/autopy-color-module.h:5,
from src/autopy-color-module.c:1:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,
from src/autopy-color-module.h:5,
from src/autopy-color-module.c:1:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/MMBitmap.c -o build/temp.macosx-10.3-intel-2.7/src/MMBitmap.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
gcc-4.0 -g -bundle -undefined dynamic_lookup -g -arch i386 -arch x86_64 build/temp.macosx-10.3-intel-2.7/src/autopy-color-module.o build/temp.macosx-10.3-intel-2.7/src/MMBitmap.o -o build/lib.macosx-10.3-intel-2.7/autopy/color.so
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;file='/Users/polzovatel/Downloads/build/autopy/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /var/folders/ha/ha8sLf91GXWORhWgw0ZW5k+++TI/-Tmp-/pip-NmBXbk-record/install-record.txt failed with error code 1
Storing complete log in /Users/polzovatel/.pip/pip.log
MyBook-2:Downloads polzovatel$
Taking a screen capture, saving it then trying to open it:
import autopy
autopy.bitmap.capture_screen().save("cap.png")
img = autopy.bitmap.Bitmap.open("cap.png")
Traceback (most recent call last):
File "", line 1, in
IOError: Error opening image: Not a PNG file
And in bmp:
autopy.bitmap.capture_screen().save("cap.bmp")
img = autopy.bitmap.Bitmap.open("cap.bmp")
Traceback (most recent call last):
File "", line 1, in
IOError: Error opening image: Unsupported BMP header
This occurs with existing png and bmp files also. I am using Windows 7 x64 with Python 2.7.
I used the win32 installer on both Win 7 and Vista 32-bit and received the following error when trying to import autopy.
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
import autopy
Traceback (most recent call last):
File "", line 1, in
File "c:\Python26\lib\site-packages\autopy__init__.py", line 8, in
import autopy.bitmap
ImportError: DLL load failed: The application has failed to start because its s
de-by-side configuration is incorrect. Please see the application event log for
more detail.
I tried installing vcredist_x86.exe to eliminate the side-by-side error but it did not work.
They're very handy. Sure, most folks will guess that the attributes are there, but it's good to be explicit :).
I dont' think tolerance is really defined in the tutorial or the API doc. What are the valid ranges for tolerance values? 0.0 to 1.0? Or greater than 1 as well?
Based on testing, I'm assuming 0.0, the default, is must be exact match? And towards 1.0 means higher tolerance for partial or even no matches. At 1.0, for a test needle, testing with find bitmap against screen capture, it returns coordinates of (1,1) when the needle is not even present.
So would be helpful to clarify for users who are not well skilled in image recognition tools.
is autopy dead ?
Both easy_install autopy
and building from source fail when building src/screengrab.c.
Below is the dump of errors:
py setup.py build
running build
running build_py
creating build
creating build/lib.macosx-10.8-intel-2.7
creating build/lib.macosx-10.8-intel-2.7/autopy
copying autopy/init.py -> build/lib.macosx-10.8-intel-2.7/autopy
running build_ext
building 'color' extension
creating build/temp.macosx-10.8-intel-2.7
creating build/temp.macosx-10.8-intel-2.7/src
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/autopy-color-module.c -o build/temp.macosx-10.8-intel-2.7/src/autopy-color-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/MMBitmap.c -o build/temp.macosx-10.8-intel-2.7/src/MMBitmap.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.8-intel-2.7/src/autopy-color-module.o build/temp.macosx-10.8-intel-2.7/src/MMBitmap.o -o build/lib.macosx-10.8-intel-2.7/autopy/color.so
building 'screen' extension
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/autopy-screen-module.c -o build/temp.macosx-10.8-intel-2.7/src/autopy-screen-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/screen.c -o build/temp.macosx-10.8-intel-2.7/src/screen.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/screengrab.c -o build/temp.macosx-10.8-intel-2.7/src/screengrab.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
clang: warning: argument unused during compilation: '-mno-fused-madd'
src/screengrab.c:48:26: warning: implicit declaration of function 'CGDisplayBitsPerPixel' is invalid in C99 [-Wimplicit-function-declaration]
bitsPerPixel = (uint8_t)CGDisplayBitsPerPixel(displayID);
^
src/screengrab.c:191:2: warning: 'CGLSetFullScreen' is deprecated [-Wdeprecated-declarations]
CGLSetFullScreen(glContext);
^
src/screengrab.c:194:2: warning: implicit declaration of function 'glReadBuffer' is invalid in C99 [-Wimplicit-function-declaration]
glReadBuffer(GL_FRONT);
^
src/screengrab.c:194:15: error: use of undeclared identifier 'GL_FRONT'
glReadBuffer(GL_FRONT);
^
src/screengrab.c:197:2: warning: implicit declaration of function 'glFinish' is invalid in C99 [-Wimplicit-function-declaration]
glFinish();
^
src/screengrab.c:199:6: warning: implicit declaration of function 'glGetError' is invalid in C99 [-Wimplicit-function-declaration]
if (glGetError() != GL_NO_ERROR) return NULL;
^
src/screengrab.c:199:22: error: use of undeclared identifier 'GL_NO_ERROR'
if (glGetError() != GL_NO_ERROR) return NULL;
^
src/screengrab.c:207:2: warning: implicit declaration of function 'glPopClientAttrib' is invalid in C99 [-Wimplicit-function-declaration]
glPopClientAttrib(); /* Clear attributes previously set. /
^
src/screengrab.c:223:2: warning: implicit declaration of function 'glPushClientAttrib' is invalid in C99 [-Wimplicit-function-declaration]
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
^
src/screengrab.c:223:21: error: use of undeclared identifier 'GL_CLIENT_PIXEL_STORE_BIT'
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
^
src/screengrab.c:225:2: warning: implicit declaration of function 'glPixelStorei' is invalid in C99 [-Wimplicit-function-declaration]
glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); / Force alignment. /
^
src/screengrab.c:225:16: error: use of undeclared identifier 'GL_PACK_ALIGNMENT'
glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); / Force alignment. */
^
src/screengrab.c:226:16: error: use of undeclared identifier 'GL_PACK_ROW_LENGTH'
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
^
src/screengrab.c:227:16: error: use of undeclared identifier 'GL_PACK_SKIP_ROWS'
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
^
src/screengrab.c:228:16: error: use of undeclared identifier 'GL_PACK_SKIP_PIXELS'
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
^
src/screengrab.c:235:2: warning: implicit declaration of function 'glReadPixels' is invalid in C99 [-Wimplicit-function-declaration]
glReadPixels(x, y, width, height,
^
src/screengrab.c:236:30: error: use of undeclared identifier 'GL_BGRA'
MMRGB_IS_BGR ? GL_BGRA : GL_RGBA,
^
src/screengrab.c:236:40: error: use of undeclared identifier 'GL_RGBA'
MMRGB_IS_BGR ? GL_BGRA : GL_RGBA,
^
9 warnings and 9 errors generated.
error: command 'clang' failed with exit status 1
I tried the getting start sample on README.md, but in the line of x_dim, y_dim = m.screen_size()
the program stops. Anyone have ideas to solve this?
My developping environment is below.
I tried lines below.
from pymouse import PyMouse
from pykeyboard import PyKeyboard
m = PyMouse()
k = PyKeyboard()
x_dim, y_dim = m.screen_size()
m.click(x_dim/2, y_dim/2, 1)
Used the 32-bit Windows installer and received the following error when trying to import autopy.
Python 2.6.4 (r264:75708, Oct 26 2009, 07:36:50) [MSC v.1500 64 bit (AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
import autopy
Traceback (most recent call last):
File "", line 1, in
File "c:\Python26\lib\site-packages\autopy__init__.py", line 7, in
import autopy.alert
ImportError: DLL load failed: %1 is not a valid Win32 application.
It doesn't appear to be in the API docs, but it's really useful. I had to look at the Bitmap instance in order to find it.
get_portion(...)
bmp.get_portion(x, y, width, height) -> Bitmap object
Returns new bitmap object created from portion of another.
Is this project still under development? Would be sad if it's droped.
I've got this error when I "import autopy" I get an error about a missing DLL,
So I've looked over the bitmap.pyd with the "explorer suite" a tool to see dll dependencies and a lot
more. There I can read that the bitmap.pyd needs "USER32.dll, GDI32.dll, KERNEL32.dll, MSVCR90.dll, python26.dll and the zlib1.dll" I have all of these dlls. The MSVCR90.dll is is the version 9.00.21022.8, the zlib1.dll 1.2.3 and python 2.6.5.
I don't know what else I can do to get the bitmap.pyd to run.
Line 40 in setup.py says
init_path = os.path.join(dir_path, '/__init__.py')
That directory separater is not required since os.path.join
automatically adds it. In it's current state, if dir_path
is an empty string, which it was in my case, init_path
would point to /__init__.py
. It needs to be changed to
init_path = os.path.join(dir_path, '__init__.py')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.