don't know if anybody ever ran into this error when loading an image in pygame?
Traceback (most recent call last):
File "SwingyMonkey.py", line 263, in <module>
game = SwingyMonkey()
File "SwingyMonkey.py", line 64, in __init__
self.background_img = pg.image.load('res/jungle-pixel.bmp').convert()
pygame.error: CGImageSourceCreateImageAtIndex() failed
let me know if anybody did!!! thanks!!!!!
This happens when you try to load a file in Mac OSX with a file location that doesn't exist, check that your file location is correct.
If you are running it through a program like NotePad++, the file may exist in that location but NotePad++ runs your program from a different location, so all your relative urls to your image won't work.
So use absolute paths instead of relative ones and see if it works.
Related
I'm trying to run this python code, but it keeps throwing the same error. I'm using pytesseract on a windows machine (coding in pycharm) to scan an image. I made a project on cloud9 that haevily used pytesseract in amazon web services and everything worked fine I am convinced that this is a windows problem. This is all in python 2.7 (this is a small test program I made to debug this same problem in a much bigger project)
Here's my code:
try:
import Image
except ImportError:
from PIL import Image
import pytesseract
filename = "Z:\Pycharm Projects\IBM-Waldon-master\screenshots\image.png"
print pytesseract.image_to_string(Image.open(filename))
I've tried making the meat of the code a function and restarting my computer but it still throws this error:
Z:\Python27\interpeter\Scripts\python.exe "Z:/Pycharm Projects/IBM-Waldon-
master/testest.py"
Traceback (most recent call last):
File "Z:/Pycharm Projects/IBM-Waldon-master/testest.py", line 9, in <module>
print pytesseract.image_to_string(Image.open(filename))
File "Z:\Python27\interpeter\lib\site-packages\pytesseract\pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "Z:\Python27\interpeter\lib\site-packages\pytesseract\pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "Z:\Python27\interpeter\lib\site-packages\pytesseract\pytesseract.py", line 111, in run_tesseract
proc = subprocess.Popen(command, stderr=subprocess.PIPE)
File "Z:\Python27\Lib\subprocess.py", line 394, in __init__
errread, errwrite)
File "Z:\Python27\Lib\subprocess.py", line 644, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Process finished with exit code 1
On Windows, PIL uses whatever program is registered to open a temporary .BMP file. When the program returns, the temporary file is deleted.
By far the most common problem is that the program sends back a return code even before it even opens the file, and the file is deleted before it can be opened. Unfortunately the default viewer in Windows Vista and 7 has this problem; XP used the Microsoft Image and Fax viewer which was OK.
You can use File Explorer to change the program associated with .BMP files.
I had already had sublime and when setting up new plug-ins, I found problem for the setup of SublimeClang. It requires libClang but I searched all my folders using the " locate clang" command and couln't find libclang at last (The doc on the web said it should be located in usr/lib/x86_64-linux-gnu/).
When i open the sublime, the console printed out like this:
Traceback (most recent call last):
File "/home/meng/.config/sublime-text-3/Packages/SublimeClang/internals/clang/cindex.py", line 95, in get_cindex_library
return cdll.LoadLibrary(filename)
File "./ctypes/__init__.py", line 431, in LoadLibrary
File "./ctypes/__init__.py", line 353, in __init__
OSError: libclang.so: cannot open shared object file: No such file or directory
error: It looks like libclang.so couldn't be loaded. You have to compile it yourself, or download from https://github.com/quarnster/SublimeClang/downloads.
Please note that this plugin uses features from clang 3.0 so make sure that is the version you have installed.
Once you have the file, you need to copy libclang.so into the root of this plugin. See http://github.com/quarnster/SublimeClang for more details.
I'm rookie in ubuntu OS and hope someone can give me help. Many thanks!
I am exploring speech recognition and came across this python library called SpeechRecognition. I am running a linux mint system and have followed the troubleshooting steps on the webpage linked above. However, I get the following error:
Traceback (most recent call last):
File "test.py", line 4, in <module>
audio = r.listen(source) # listen for the first phrase and extract it into audio data
File "/usr/local/lib/python2.7/dist-packages/speech_recognition/__init__.py", line 268, in listen
buffer = source.stream.read(source.CHUNK)
File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 605, in read
return pa.read_stream(self._stream, num_frames)
KeyboardInterrupt
Any help is greatly appreciated. I also do understand that the KeyboardInterrupt part of the error is from my doing, pressing ctrl+c.
I seem to have a strange error when trying to build my app
Couldn't import generation code: No module named generate_dynamic
What is strange about this error is that I can seem to resolve the error if I uninstall and re-install trigger.io but if I make any changes tot he config the error comes back and I have to uninstall and re-install each time I make a change to the configs. It never used to do this.
Traceback (most recent call last):
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\async.py", line 106, in run
result = self._target(*self._args, **self._kwargs)
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\trigger\api\app.py", line 290, in package
build(cookies, path, target)
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\trigger\api\app.py", line 329, in build
forge_main.development_build([target, '--general.interactive', 'no'])
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\main.py", line 335, in development_build
manager.fetch_instructions()
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\templates.py", line 90, in fetch_instructions
import_generate_dynamic(do_reload=True)
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\build.py", line 48, in import_generate_dynamic
raise ForgeError("Couldn't import generation code: {0}".format(e))
ForgeError: Couldn't import generation code: No module named generate_dynamic
That is the debug. Note sure what is going on.
Thanks.
So it looks like its not resolved, I tried to update a module and the whole thing blew up again. I sent the logs to support so we will see how long this will take.
* Edit *
I was able to resolve this by deleting the trigger.Io directory ( the uninstall does not do this ) then reinstalling and importing my project again. Not sure what happened but it's working now
I deleted the .tempalte folder and re-built. Looks like the content of that folder got jacked during a failed or canceled build.
I'm genetating a .exe with python and when i try to run it, a .log is generated with the following lines:
Traceback (most recent call last):
File "cuasimodo.py", line 1077, in
IOError: [Errno 2] No such file or directory: 'index.json'
obviously index.json is a file of my program which is in the same file as the rest, but it's having some problems finding it.
any idea?
When you open a file without specifying the full path, it is opened from the current working directory. It is better to specify the full path.
See "You want to know WHERE your .exe is".