(Python) ColabTurtle requires has initializeturtle() error, but we already used it - python

code:
import ColabTurtle.Turtle as tutel
tutel.initializeTurtle()
tutel.forward(10)
error is:
<IPython.core.display.HTML object>
Traceback (most recent call last):
File "f:\stuff\e.py", line 3, in <module>
tutel.forward(10)
File "C:\Users\U.S.E.R\AppData\Local\Programs\Python\Python311\Lib\site-packages\ColabTurtle\Turtle.py", line 174, in forward
_moveToNewPosition(ending_point)
File "C:\Users\U.S.E.R\AppData\Local\Programs\Python\Python311\Lib\site-packages\ColabTurtle\Turtle.py", line 163, in _moveToNewPosition
_updateDrawing()
File "C:\Users\U.S.E.R\AppData\Local\Programs\Python\Python311\Lib\site-packages\ColabTurtle\Turtle.py", line 144, in _updateDrawing
raise AttributeError("Display has not been initialized yet. Call initializeTurtle() before using.")
AttributeError: Display has not been initialized yet. Call initializeTurtle() before using.
basically, it tells me to use intializeturtle() before running a ColabTurtle function. Except, i did already use it.
Help.

Try to run it in Google Collab. If there will be no module ColabTurtle, you need to create a new code (+code) and write
!pip install ColabTurtle

Related

Getting OSError when running script

I am trying to set up the ChirpSDK, but every time I configure and run the code, I get this error:
Traceback (most recent call last):
File "test.py", line 3, in <module>
chirp = ChirpSDK()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 395, in __init__
self.read_chirprc(block)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 501, in read_chirprc
raise IOError('Could not find a ~/.chirprc file')
OSError: Could not find a ~/.chirprc file
Exception ignored in: <function ChirpSDK.__del__ at 0x10fa31af0>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 422, in __del__
self.close()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 470, in close
if self._sdk:
AttributeError: 'ChirpSDK' object has no attribute '_sdk'
I realize that the error is saying that my .chirprc file is not being recognized, but I have no idea how to remedy this. I created a .chirprc file in my /Users/username/ path, and named it c.chirprc (as the Chirp getting started article suggests), but I am still getting this error. Is there another part that I am missing? Am I reading the instructions wrong?
Thanks
The Chirp configuration file should be placed at /Users/<username>/.chirprc on macOS.
If you run ls -l ~/.chirprc in the terminal, do you get any results? If it displays no such file or directory then you have not created the file correctly.

Why did I get the error 'cannot load external tileset'

I just want to know how to fix the error that I mention in the title.
I really don't know what to try, there are only 3 lines of code and they are exactly how it's shown in the doc of pytmx...
import pygame
import pytmx
tmxdata = pytmx.TiledMap("map test pygame.tmx")
I just want to "load" the map that I create without this HUGE error:
Cannot load external tileset: C:\Users\WILHEM\Desktop\brdl Python 3\projet\labyrinthe\test pygame tileset.tsx
Traceback (most recent call last):
File "C:\Users\WILHEM\Desktop\brdl Python 3\projet\labyrinthe\testTMX.py", line 4, in <module>
tmxdata = pytmx.TiledMap("C:/Users/WILHEM/Desktop/brdl Python 3/projet/labyrinthe/carte test pygame.tmx")
File "C:\Users\WILHEM\Desktop\brdl Python 3\Python37-32\lib\site-packages\pytmx\pytmx.py", line 360, in __init__
self.parse_xml(ElementTree.parse(self.filename).getroot())
File "C:\Users\WILHEM\Desktop\brdl Python 3\Python37-32\lib\site-packages\pytmx\pytmx.py", line 400, in parse_xml
self.add_tileset(TiledTileset(self, subnode))
File "C:\Users\WILHEM\Desktop\brdl Python 3\Python37-32\lib\site-packages\pytmx\pytmx.py", line 845, in __init__
self.parse_xml(node)
File "C:\Users\WILHEM\Desktop\brdl Python 3\Python37-32\lib\site-packages\pytmx\pytmx.py", line 874, in parse_xml
raise Exception
Exception
If you can help me... Thank you very much from the bottom of my heart!
from pytmx.util_pygame import load_pygame
load_pygame(filename,pixilalpha=True)

ImportError: No module named __main__ (Python 2.7 & Pickle)

So on my game I'm making, I'm trying to load the data files needed for the game, and when I load the file with pickle (The file has been loaded, I've double-checked that.) I get this error:
Traceback (most recent call last):
File "/Users/user/Downloads/Deeper-master/Deeper.py", line 257, in <module>
tutorialData = pickle.load(tutorialFile)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1384, in load
return Unpickler(file).load()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 864, in load
dispatch[key](self)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1075, in load_inst
klass = self.find_class(module, name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1130, in find_class
__import__(module)
ImportError: No module named __main__
I saw a question like this on Stack Overflow, but it's a little different than my situation, so sorry if this is a duplicate, I'm just trying to figure it out.
You can find my code here. The main script is Deeper.py, just to save time.
If you notice in your repo, you have a Deeper.pyc and Deeper.py. If I run Deeper.py, it raises the same exception as yours. If I run Deeper.pyc, it raises another exception:
Traceback (most recent call last):
File "Deeper.py", line 7, in <module>
ToolbarTile = pygame.image.load("ToolbarTile.png")
pygame.error: Couldn't open Toolbar Tile.png
So, the code (bytecode, some previous version) references ToolbarTile.png, but the exception is about Toolbar Tile.png (with a space). So I changed the file name to account for that.
Now it raises:
Traceback (most recent call last):
File "Deeper.py", line 766, in <module>
else:
File "Deeper.py", line 394, in __init__
def displayCraft(self):
pygame.error: Couldn't open options.png
There's an Options.png in your files, but it looks for options.png (lower case) (even your new code in Deeper.py looks for that). So I changed that.
Now it works, albeit with Deeper.pyc so that must be why you thought:
(The file has been loaded, I've double-checked that.)
Maybe delete the Deeper.pyc and do a git-bisect to see when the bug was introduced (ps: check your toolbar.dat, does it seem okay to you? Also check the way you're using pickle.load. Maybe you should use rb instead of r?)

Create an executable from Selenium Python for IE with Pyinstaller

I have created a set of python scripts that scrape information out of a website using Internet Explorer. This methodology while not ideal, is the only way I could get it to work as the site does not work well with other browsers and has single-sign on authentication which was difficult to deal with through requests. Anyways, it works. I'd like to be able to share with coworkers without them needing to install python or modify scripts.
I was able to create an executable of the scripts that works on my computer through pyinstaller. When I share with coworkers, though, the get an error "local variable 'browser' referenced before assignment." I tried referencing the IEWebdriverService.exe the binaries field of the pyinstaller .spec file. This caused the size of the .exe to grow so it did something..but it didn't solve the problem.
This is my first time creating an executable and I have really no idea how the IE Driver works so I'm stuck at the moment. Any help would be greatly appreciated. I'm open to using another tool than pyinstaller if that helps, I just found it the easiest to use of the alternatives. I'm using Python 3.5.
thanks.
Edit - Error Log
run # 1
['Part Number = 12649189']
Error
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.se
rvice.Service object at 0x0000000004D00D30>>
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver\common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
['Part Number = 12649189']
Error
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.se
rvice.Service object at 0x0000000004D00D30>>
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver\common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
['Part Number = 12649189']
Error
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.se
rvice.Service object at 0x0000000004D00D30>>
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver\common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
Traceback (most recent call last):
File "Parent_Part_W_UI.py", line 138, in <module>
File "Parent_Part_W_UI.py", line 23, in __init__
File "Parent_Part_W_UI.py", line 40, in init_window
File "Parent_Part_W_UI.py", line 122, in execute_main
UnboundLocalError: local variable 'browser' referenced before assignment

jirashell throws a "KeyError: u'consumer_key'" and does not start

I am new to jira-python and have run into an issue with using jirashell.
jira-python was installed from documentation given here: http://jira.readthedocs.org/en/latest/
When I try to start jirashell using:
ubuntu#ip-10-0-0-12:~$ jirashell -s https://jira.atlassian.com
I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/jirashell", line 11, in <module> sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/jira/jirashell.py", line 248, in main
jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 202, in __init__self._create_oauth_session(oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 1871, in _create_oauth_session
oauth['consumer_key'],
KeyError: u'consumer_key'
I have also tried to get to a server using basic auth but that returns the same error. Using curl works fine, but I wanted to see the objects that are getting returned and get help as I develop by python-jira integration.
Thank you for any insight.

Categories

Resources