Python

Python function not being called

I have a python class and couple of functions, 1st calling 2nd. However, 2nd is never getting called. Also the line after _method2() invocation is never executed. class call_methods(): def _method1(self,context): print “Now call method 2”; this._method2(context); print “Finish”; return {} def _method2(context={}): print “method 2 called” return {} Output: Now call method 2 Only 1st print statement comes out….
Read more

Django admin upload media to FTP on Heroku

I am uploading static images from admin to my ftp. However, I am having an issue that causes Heroku H12 error. I am using uwsgi. MY uwsgi.ini file is below [uwsgi] http-socket = :$(PORT) master = true processes = 4 die-on-term = true module = project.wsgi memory-report = true The model on_save has been overridden to create thumbnail and save…
Read more

How to edit HTML, CSS and Javascript in Plone 4.3?

I have never used Plone before. I would like to change an existing website’s HTML, CSS and Javascript by using the local copies I have written so far. Which files do I have to look into in order to be able to change that? In other words, I would like to edit the default Sunburst layout. Any help would be…
Read more

How to search an Excel column for a range of values

I have 2 Excel files, one containing a list of emails of people that need to be removed (i.e. removal file), and a second Excel file that contains the active list of people (i.e. roster file). I want to search the email column of the roster file for the list of emails to be removed, and then copy the new…
Read more

MySQL Python installation error on python 3 for mac

I have done so much research for connection databases on python and still canot figure it out. I have used mysql.connector, MySQLdb, and pymysql and none seem to work. For example import pymysql >>> db = pymysql.connect(host=”127.0.0.1″, user=”root”, passwd=””, db=”forge”) Traceback (most recent call last): File “/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pymysql/connections.py”, line 669, in _connect sock.connect((self.host, self.port)) ConnectionRefusedError: [Errno 61] Connection refused During handling…
Read more

Using python for grouping similar set of words

I want to group the similar set of searches which land in a ‘No Page Found’ page. This would basically help me optimizing the search engine. I’m actually looking at grouping the words/phrases people use to find a particular product but are not landing on the product page. It has to be dynamic as I’ve over a million key words…
Read more

SWIG and Python: define custom exception on Python side

I was able to use %exception with C# and Java to throw custom exception classes which I wrote by hand in the target language. I use %exception with Python too but with Python’s built-in PyExc_Exception type and this works: try: do(); except Exception as ex: print(ex) Is there a way to achieve the following? try: do(); except CustomException as ex:…
Read more