I am trying to make a game with pygame using tiled. When I edit tilesheets (to for example add collision) I get a bunch of error messages when I run my code.
When I use the same tilesheet without editing I get no errors and all the files work.
Traceback (most recent call last):
File "C:/Users/47988/PycharmProjects/Terrible/Main.py", line 94, in
<module>
g = Game()
File "C:/Users/47988/PycharmProjects/Terrible/Main.py", line 16, in init
self.load_data()
File "C:/Users/47988/PycharmProjects/Terrible/Main.py", line 22, in load_data
self.map = TiledMap(path.join(map_folder, "map6.tmx"))
File "C:\Users\47988\PycharmProjects\Terrible\Tilemap.py", line 21, in init
tm = pytmx.load_pygame(filename, pixelalpha=True)
File "C:\Users\47988\PycharmProjects\Terrible\venv\lib\site- packages\pytmx\util_pygame.py", line 141, in load_pygame
return pytmx.TiledMap(filename, *args, **kwargs)
File "C:\Users\47988\PycharmProjects\Terrible\venv\lib\site-packages\pytmx\pytmx.py", line 360, in init
self.parse_xml(ElementTree.parse(self.filename).getroot())
File "C:\Users\47988\PycharmProjects\Terrible\venv\lib\site- packages\pytmx\pytmx.py", line 400, in parse_xml
self.add_tileset(TiledTileset(self, subnode))
File "C:\Users\47988\PycharmProjects\Terrible\venv\lib\site-packages\pytmx\pytmx.py", line 845, in init
self.parse_xml(node)
File "C:\Users\47988\PycharmProjects\Terrible\venv\lib\site-packages\pytmx\pytmx.py", line 874, in parse_xml
raise Exception
Exception
Is there any way of solving this?
Related
when I write the command line in terminal
bench new-site site1.local
This Error Will shown
> Traceback (most recent call last):
File "/home/ubuntu/.local/bin/bench", line 8, in <module>
sys.exit(cli())
File "/home/ubuntu/bench/bench/cli.py", line 71, in cli
cmd_from_sys = get_cmd_from_sysargv()
File "/home/ubuntu/bench/bench/utils/__init__.py", line 554, in get_cmd_from_sysargv
if sys_argv.index(arg) == 0 and arg in Bench(".").apps:
File "/home/ubuntu/bench/bench/bench.py", line 67, in __init__
self.apps = BenchApps(self)
File "/home/ubuntu/bench/bench/bench.py", line 174, in __init__
self.initialize_apps()
File "/home/ubuntu/bench/bench/bench.py", line 281, in initialize_apps
self.apps.remove("frappe")
ValueError: list.remove(x): x not in list
Note I use EC2 On AWS Ubunto server
Can Any One Help With This Problem Please.
I tried to install many lib but no help with this problem
I've written the following python loop to display multiple gif files one after another. The code works fine on one of my machines with a dedicated GPU but only displays one gif on my laptop with an AMD iGPU displaying the following error msg after closing the first window (both PCs run windows 10):
import pyglet
def play_animation(ag_file):
animation = pyglet.image.load_animation(ag_file)
sprite = pyglet.sprite.Sprite(animation)
win = pyglet.window.Window(width=sprite.width, height=sprite.height)
green = 0, 1, 0, 1
pyglet.gl.glClearColor(*green)
#win.event
def on_draw():
win.clear()
sprite.draw()
pyglet.app.run()
if __name__ == '__main__':
gif_list = ['gif1.gif', 'gif2.gif']
for gif in gif_list:
print(gif)
play_animation(gif)
And the error I get after I close the first animation is:
gif1.gif
gif2.gif
Traceback (most recent call last):
File "main.py", line 226, in <module>
play_animation(Save_Name)
File "main.py", line 29, in play_animation
pyglet.app.run()
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\__init__.py", line 107, in run
event_loop.run(interval)
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\base.py", line 186, in run
timeout = self.idle()
^^^^^^^^^^^
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\base.py", line 247, in idle
self.clock.call_scheduled_functions(dt)
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\clock.py", line 262, in call_scheduled_functions
item.func(now - item.last_ts, *item.args, **item.kwargs)
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\base.py", line 153, in _redraw_windows
window.dispatch_event('on_draw')
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\window\__init__.py", line 1363, in dispatch_event
super().dispatch_event(*args)
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\event.py", line 415, in dispatch_event
if handler(*args):
^^^^^^^^^^^^^^
File "main.py", line 19, in on_draw
sprite.draw()
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\sprite.py", line 820, in draw
self._vertex_list.draw(GL_TRIANGLES)
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\graphics\vertexdomain.py", line 276, in draw
self.domain.draw_subset(mode, self)
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\graphics\vertexdomain.py", line 491, in draw_subset
self.vao.bind()
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\graphics\vertexarray.py", line 58, in bind
glBindVertexArray(self._id)
File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\gl\lib.py", line 114, in errcheck
raise GLException('(0x%x): %s' % (error, msg))
pyglet.gl.lib.GLException: (0x502): Invalid operation. The specified operation is not allowed in the current state.
I updated the driver on both machines and installed the latest version of python (3.11) and pyglet (2.0.2.1) as well as all Updates for windows
I am running the code from this repository Link with dgl==0.1.3 and I am facing this error. I am not sure why its coming. I have attached the code snippet and the error below.
code snippet
def _prepare_subgraphs(self, nodes, r_label, n_labels):
subgraph = dgl.DGLGraph(self.graph.subgraph(nodes))
Error
Traceback (most recent call last):
File "train.py", line 222, in <module>
main(params)
File "train.py", line 32, in main
kge_model=params.kge_model, file_name=params.train_file)
File "/home2/harsha.vasamsetti/SumGNN-master_olddgl/subgraph_extraction/datasets.py", line 142, in __init__
self.__getitem__(0)
File "/home2/harsha.vasamsetti/SumGNN-master_olddgl/subgraph_extraction/datasets.py", line 150, in __getitem__
subgraph_pos = self._prepare_subgraphs(nodes_pos, r_label_pos, n_labels_pos)
File "/home2/harsha.vasamsetti/SumGNN-master_olddgl/subgraph_extraction/datasets.py", line 159, in _prepare_subgraphs
subgraph = dgl.DGLGraph(self.graph.subgraph(nodes))
File "/home2/harsha.vasamsetti/.miniconda3/envs/sumgnn=0.1.3/lib/python3.7/site-packages/dgl/graph.py", line 181, in __init__
self._graph = create_graph_index(graph_data, multigraph, readonly)
File "/home2/harsha.vasamsetti/.miniconda3/envs/sumgnn=0.1.3/lib/python3.7/site-packages/dgl/graph_index.py", line 925, in create_graph_index
% type(graph_data))
dgl._ffi.base.DGLError: Error while creating graph from input of type "<class 'dgl.subgraph.DGLSubGraph'>".
I write python layer for caffe that can read hdf5 with some manipulation needs for me. But I have some issue when open and read hdf5 file in python setup method. Here it is.
When I used tables with the
code in setup:
def setup(self, bottom, top):
h5file = tables.open_file("/home/titan/models/hdf5/train_small.h5", driver="H5FD_CORE")
I have this error when run net:
Traceback (most recent call last):
File "/home/titan/scripts/python_layers/pydata_hdf5.py", line 37, in setup
h5file = tables.open_file("/home/titan/models/hdf5/train_small.h5", driver="H5FD_CORE")
File "/home/titan/anaconda/lib/python2.7/site-packages/tables/file.py", line 318, in open_file
return File(filename, mode, title, root_uep, filters, **kwargs)
File "/home/titan/anaconda/lib/python2.7/site-packages/tables/file.py", line 784, in __init__
self._g_new(filename, mode, **params)
File "tables/hdf5extension.pyx", line 465, in tables.hdf5extension.File._g_new (tables/hdf5extension.c:4872)
tables.exceptions.HDF5ExtError: HDF5 error back trace
File "../../../src/H5FDcore.c", line 273, in H5Pset_fapl_core
not a file access property list
File "../../../src/H5Pint.c", line 3371, in H5P_object_verify
property list is not a member of the class
File "../../../src/H5Pint.c", line 3321, in H5P_isa_class
not a property list
End of HDF5 error back trace
When I used h5py
def setup(self, bottom, top):
self.data = h5py.File('/home/titan/models/hdf5_nose_mouth/train_small.h5', 'r')
I have the same error:
Traceback (most recent call last):
File "/home/titan/scripts/python_layers/pydata_hdf5.py", line 11, in <module>
import h5py
File "/home/titan/anaconda/lib/python2.7/site-packages/h5py/__init__.py", line 31, in <module>
from .highlevel import *
File "/home/titan/anaconda/lib/python2.7/site-packages/h5py/highlevel.py", line 13, in <module>
from ._hl.base import is_hdf5, HLObject
File "/home/titan/anaconda/lib/python2.7/site-packages/h5py/_hl/base.py", line 78, in <module>
dlapl = default_lapl()
File "/home/titan/anaconda/lib/python2.7/site-packages/h5py/_hl/base.py", line 65, in default_lapl
lapl = h5p.create(h5p.LINK_ACCESS)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (-------src-dir-------/h5py/_objects.c:2458)
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (-------src-dir-------/h5py/_objects.c:2415)
File "h5py/h5p.pyx", line 130, in h5py.h5p.create (-------src-dir-------/h5py/h5p.c:2491)
ValueError: Not a property list class (Not a property list class)
When I used deepdish:
def setup(self, bottom, top):
self.data = dd.io.load('/home/titan/models/hdf5/train_smallest.h5')
I have error too:
Traceback (most recent call last):
File "/home/titan/scripts/python_layers/pydata_hdf5.py", line 36, in setup
self.data = dd.io.load('/home/titan/models/hdf5/train_smallest.h5')
File "/home/titan/anaconda/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 476, in load
with tables.open_file(path, mode='r') as h5file:
File "/home/titan/anaconda/lib/python2.7/site-packages/tables/file.py", line 318, in open_file
return File(filename, mode, title, root_uep, filters, **kwargs)
File "/home/titan/anaconda/lib/python2.7/site-packages/tables/file.py", line 784, in __init__
self._g_new(filename, mode, **params)
File "tables/hdf5extension.pyx", line 488, in tables.hdf5extension.File._g_new (tables/hdf5extension.c:5081)
tables.exceptions.HDF5ExtError: HDF5 error back trace
File "../../../src/H5F.c", line 1582, in H5Fopen
not file access property list
File "../../../src/H5Pint.c", line 3321, in H5P_isa_class
not a property list
End of HDF5 error back trace
But when I read simply *.txt file, all is ok. Also I can read this file from console and use it in hdf5 layer in caffe. Please help me, how I can read hdf5 file from python layer?
Try to install another version of h5py. I just solved it with:
pip install h5py==prev_version
I guess it has something to do with the linking but it would be interesting to know which is the exact cause for this problem.
Does anyone have any experience using Python with AutoCAD? I'm just trying, as a test to see if I can open a new instance of AutoCAD via Python and though that PyAutocad worked well (feel free to offer other suggestions, if you have any).
Anyway based on the doc (https://pypi.python.org/pypi/pyautocad/#downloads) - it says these lines of code should do it, but nothing's happened as of yet.
from pyautocad import Autocad, APoint
acad = Autocad()
acad.prompt("Hello, Autocad from Python\n")
Just these lines of code should generate info on the commandline but instead results in about 50 lines worth of traceback (which I can post as well if anyone's interested) - any ideas?
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
acad.prompt("Hello, Autocad")
File "C:\Python27\lib\site-packages\pyautocad\api.py", line 153, in prompt
self.doc.Utility.Prompt(u"%s\n" % text)
File "C:\Python27\lib\site-packages\pyautocad\api.py", line 65, in doc
return self.app.ActiveDocument
File "C:\Python27\lib\site-packages\pyautocad\api.py", line 54, in app
self._app = comtypes.client.GetActiveObject('AutoCAD.Application')
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 180, in GetActiveObject
obj = comtypes.GetActiveObject(clsid, interface=interface)
File "C:\Python27\lib\site-packages\comtypes\__init__.py", line 1165, in GetActiveObject
oledll.oleaut32.GetActiveObject(byref(clsid), None, byref(p))
File "_ctypes/callproc.c", line 941, in GetResult
WindowsError: [Error -2147221021] Operation unavailable
After adding the VBA Module, the traceback now reads:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
acad.prompt("Hello")
File "C:\Python27\lib\site-packages\pyautocad\api.py", line 153, in prompt
self.doc.Utility.Prompt(u"%s\n" % text)
File "C:\Python27\lib\site-packages\pyautocad\api.py", line 65, in doc
return self.app.ActiveDocument
File "C:\Python27\lib\site-packages\pyautocad\api.py", line 54, in app
self._app = comtypes.client.GetActiveObject('AutoCAD.Application')
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 183, in GetActiveObject
return _manage(obj, clsid, interface=interface)
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 112, in GetBestInterface
interface = getattr(mod, itf_name)
AttributeError: 'module' object has no attribute 'IAcadApplication'
Now after deleting comtypes' "gen" folder per #reclosedev, Autocad now opens but the string of text still will not appear on the command line - the traceback reads:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
acad.prompt("Hello")
File "C:\Python27\lib\site-packages\pyautocad\api.py", line 153, in prompt
self.doc.Utility.Prompt(u"%s\n" % text)
File "C:\Python27\lib\site-packages\pyautocad\api.py", line 65, in doc
return self.app.ActiveDocument
File "C:\Python27\lib\site-packages\pyautocad\api.py", line 59, in app
self._app.Visible = self._visible
File "C:\Python27\lib\site-packages\comtypes\client\dynamic.py", line 116, in __setattr__
dispid = self._comobj.GetIDsOfNames(name)[0]
File "C:\Python27\lib\site-packages\comtypes\automation.py", line 643, in GetIDsOfNames
self.__com_GetIDsOfNames(riid_null, arr, len(names), lcid, ids)
COMError: (-2147418111, 'Call was rejected by callee.', (None, None, None, 0, None))
Have you considered IronPython?
http://through-the-interface.typepad.com/through_the_interface/2009/03/using-ironpython-with-autocad.html
Here's a quick example of how it could be leveraged:
import clr
import System
from System import Type, Activator
acApp = Activator.CreateInstance(Type.GetTypeFromProgID("AutoCAD.Application"))
acApp.Visible = 1
acApp.ActiveDocument.SendCommand("(Princ \"Hello World from Python!\")(Princ)\n")
Obviously the ProgId will correspond to whichever version of AutoCAD was opened last.