Tagged Questions
3
votes
0answers
140 views
“AttributeError: 'NoneType' object has no attribute 'write'” when dividing two arrays element-wise
I want to divide two one-dimensional arrays element-wise. There will be divisions by zero, but I still want to do the division. The result of div/0 is irrelevant, I'll handle that later.
Why does ...
2
votes
0answers
67 views
Class objects seem to reset
I am a C Programmer, but want to prototype some of my projects in python, so far its alright, but I'm stuck on a probably easy problem:
I have a Class which internals are not working, when I recreate ...
1
vote
0answers
60 views
How to draw 10,000+ objects and move them and get 60fps+ in Vizard Python
I am trying to create a world in Vizard 4.0 that automatically generates 10,000+ objects in it. Once these objects are made, I want to fly through them or make them move at a certain speed in any ...
1
vote
0answers
49 views
Inheriting from 'object' breaks __getstate__ & __setstate__?
Setting up a base class to handle keeping track of class instances while still allowing garbage collection. The second answer from this post is close, but I also need to add to the instances list when ...
1
vote
0answers
68 views
In python, how do I serialize objects containing function objects and back?
Let's say that I have a dictionary containing a reference to a function and some other elements, like:
mydict={'a':1.0,'b':7.89,'c':<function mylib.sum>}
is there any way to serialize this, ...
1
vote
0answers
462 views
Preferable way to dynamically call some object's method
What is more preferable way to dynamically call some object's method:
method = getattr(object, name)
method(*args, **kw)
Or
import operator
method = operator.methodcaller(name)
method(object, ...
0
votes
0answers
15 views
Blender Python API add property to object
Here's what I'm trying to do:
reference_object= bpy.context.active_object
reference_object.add_variable(name='some_property',value=5)
reference_object.some_property
and it would print back 5
I ...
0
votes
0answers
32 views
Python Create Series Of Text Menus- Classes/Objects or Decorator Functions?
I am creating a series of text menus in Python. I've been told in Python conventions that I should only make classes/objects for data members that need to be maintained and manipulated. Going be this ...
0
votes
0answers
30 views
Is it possible to have an ndb property that contains the key of a python object?
Sorry if this question allready have been answered. I coudn't find it, so please let me know if this thread already exists.
I need to have a ndb property that allows to store python keys. I tried to ...
0
votes
0answers
20 views
Converting Parser element to Class Object
I Have tried out the following code for Converting parser element to a class object
But it did n't work properly ..... Hope some one can help me to solve it ...
import xml.etree.ElementTree as ET
...
0
votes
0answers
40 views
Accessing python container's parent object
I need to create a containers that can access its children but also its parent.
Here is a simple example of how I was thinking to do that :
import numpy as np
import gc
class Node(object):
...
0
votes
0answers
66 views
how to use the PyObject_CallMethod send the object from C++ to the python
When I write the C++ call python , now I have a object in the C++, how to send this object to the python, and in the python can use this object:
because the PyObject_CallMethod can send the int , ...
0
votes
0answers
49 views
Memory sharing custom objects in Python multiprocessing
I have several models loaded in memory, each model is an object of my custom Python class. These models themselves consist of 100s of MB of internal data each. I'm receiving small requests, which are ...
0
votes
0answers
35 views
Can't create an object from one .py file in another .py file in the same directory
In one file I create a class called Player, but when I try to create an object of that class in another file I'm told that global name "Player" is not defined. Why would this be?
Edit: At the top of ...
0
votes
0answers
73 views
modifying python code to make it 'importable'
I've been trying to modify the code below so I can import the lcd class and call the writeLCD function as a function call on an object in another class. I'm stuck at the moment because when i try ...