I have this line:
NSWorkspace.sharedWorkspace().setIcon_forFile_options_(unicode(icon),unicode(target),0)
Why does it give that error and how do I fix it?
Thank you.
...
So I have this code in python that writes some values to a Dictionary where each key is a student ID number and each value is a Class (of type student) where each Class has some variables associated with it. '
Code
try:
if ((str(i) in row_num_id.iterkeys()) and (row_num_id[str(i)]==varschosen[1])):
...
Preferable C/C++, Python or Java. I'm tired of doing simple and silly applications. I would like to start or help in a big project, but I don't know how to do it and what to do. Any idea?
...
If I have an array like
a = np.array([2, 3, -1, -4, 3])
I want to set all the negative elements to zero: [2, 3, 0, 0, 3]. How to do it with numpy without an explicit for? I need to use the modified a in a computation, for example
c = a * b
where b is another array with the same length of the original a
Conclusion
import numpy as ...
if I run a .py script, can I open a new terminal, modify the file and run it also?
i.e. does the file that I run get loaded in memory, such that I can modify the file and run it at the same time in a different terminal?
...
Hello everyone!
I am trying to make my server send gzipped data. I have a grok application that runs over Paste (Paste-1.7.2-py2.4.egg)
I have been trying to google how to make all that environment to serve data in gzip... But without success... I think the answer comes in http://pythonpaste.org/modules/gzipper.html but if I do this:
...
I would like to inherit from list to produce the myList class, that ony accepts one specific type of object (say ints).
I am sure decorators can do that elegantly.
Thanks
...
Using Windows XP and Python 2.7 I tried to run "pydoc" through the terminal. unfortunately it doesn't work.
Since I'm not allowed to post a screenshot (Newbie). Here is what it says (white on black)
"C:\Python27>pydoc raw_input /"pydoc raw_input" is what I typed
Der Befehl "pydoc" ist entweder falsch geschrieben oder konnte nicht gefu...
I have a Django application which edits a database table, which another application polls and uses to update a downstream system. In order to minimize processing when the database has not been altered in between polls, I would like to use a global modification time for a model, which is updated every time a row is created/deleted/modifi...
Hi.
For a project, I need to generate XML files which adhere to a specific format. I was wondering, what is the standard way of doing this?
For my part I am using lxml and then writing the XML files. For this, I wrote a small script that takes in XML data as input and then generates the files.
Is this way of doing it 'OK'? Cause I a...
for subdir, dirs, files in os.walk(crawlFolder):
for file in files:
print os.getcwd()
f=open(file,'r')
lines=f.readlines()
writeFile.write(lines)
f.close()
writeFile.close()
I get the error as:-
IOError: [Errno 2] No such file or directory
In reference to my partial python code abov...
Would it be possible and not incredibly difficult to build a linux kernel, with a python interpreter built in or accessible from the kernel, that could run a python file as it's init process?
...
In alpha, beta pruning algorithm,
I have a class in which a fucntion def getAction(self,gamestate) id defined. I made 2 more function in def getAction
Like:
class BAC:
def you(self,gamestate):
def me(gamestate,depth,alpha, beta):
------
return v
def both(gamestate,depth,alpha, beta):
-------------------
...
drug_input=['MORPHINE','CODEINE']
def some_function(drug_input)
generic_drugs_mapping={'MORPHINE':0,
'something':1,
'OXYCODONE':2,
'OXYMORPHONE':3,
'METHADONE':4,
...
My idea is to achieve an execution similar to the MySQL MATCH / AGAINST keywords.
Do you know a python library that compute relevance score for text searches?
If not satisfying answers I am going to use a Python connector to MySQL.
...
Select all works like this:
q = session.query(products)
Now I want to add a WHERE filter, so I am trying:
q = session.query(products).filter_by(stock_count=0)
I get an error saying 'nonetype' object has no attribute 'class_manager'.
Not sure what the issue is?
Update
The column seems to be mapped fine, as when I do:
q = session....
The website says:
Closing connections: Fabric’s
connection cache never closes
connections itself – it leaves this up
to whatever is using it. The fab tool
does this bookkeeping for you: it
iterates over all open connections and
closes them just before it exits
(regardless of whether the tasks
failed or not.)
Libr...
(I am using python 2.7) The python documentation indicates that you can pass a mapping to the dict builtin and it will copy that mapping into the new dict:
http://docs.python.org/library/stdtypes.html#mapping-types-dict
I have a class that implements the Mapping ABC, but it fails:
import collections
class Mapping(object):
def __i...
i have a set like this:
keep = set(generic_drugs_mapping[drug] for drug in drug_input)
how do i add values [0,1,2,3,4,5,6,7,8,9,10] in to this set?
...
b holds the contents of a csv file
i need to go through every row of b; however, since it has a header, i dont want to pay attention to the header. how do i start from the second row?
for row in b (starting from the second row!!):
...