Tag Archives: python

Virtual environment wrong python version

Questions: I am having a problem with virtual environment and mod_wsgi configuration. I have this in my apache configuration: WSGIDaemonProcess myapp python-path=/mnt/myapp/current:/mnt/env/lib/python3.4/site-packages which clearly states that I am using python3.4. But if I am in my virtual environment if I do the following, I am getting info that Python version is 3.4.3: (env)root@Python:/mnt/env/bin# python Python… Read More »

Python or Jython for Django based application?

Questions: We are going to start developing Django based application. It requires speed optimisation (need to serve k+ requests/sec), n number of nodes with HAproxy and PostgreSQL load-balancing. Presently we consider using Python, Apache, memcached Jython, Glassfish The application should scale overtime, Python or Jython. Any suggestion? Answers: Which language you know better? JVM based… Read More »

Eclipse Pydev: 'Error: Python stdlib not found'

Questions: I am trying to add an interpreter (created using virtualenv) to PyDev but I get the following error: It seems that the Python /Lib folder (which contains the standard library) was not found /selected during the instal process. This folder (which contains files such as threading.py and traceback.py) is required for PyDev to function… Read More »

Recommended .gitignore file for Python projects?

Questions: I’m trying to collect some of my default settings, and one thing I realized I don’t have a standard for is .gitignore files. There’s a great thread showing a good .gitignore for Visual Studio projects, but I don’t see many recommendations for Python and related tools (PyGTK, Django). So far, I have… *.pyc *.pyo… Read More »

Parsing Excel files with Python 3.x

Questions: I have found very few libraries in Python able to parse excel files, and none of them were in Python 3.x nor passed with success the 2to3 step. What would be your suggestions ? Answers: Have a look at Python Package Index (Pypi), section Python 3 . xlrd3 is a port of xlrd, a… Read More »

How to update/modify a XML file in python?

Questions: I have a xml file that I would like to update after it has already data. I thought about open the xml file in “a” (append) mode. The problem is that the new data will start to be dumped after the “root” tag has been closed. What I wanted someone to be kind enough… Read More »

XML parsing in python: expaterror not well-formed

Questions: I’m using Python’s xml.etree.ElementTree to do some XML parsing on a file. However, I get this error mid-way through the document: xml.parsers.expat.ExpatError: not well-formed (invalid token): line X, column Y So I go to line X, column Y in vim and I see an ampersand (&) with red background highlighting. What does this mean?… Read More »

How we can use iter_rows() in Python openpyxl package?

Questions: I’m using openpyxl package in Python(Canopy) to use excel files. We have this tutorial in this link : LINK you can also use the openpyxl.worksheet.Worksheet.iter_rows() method: >>> tuple(ws.iter_rows(‘A1:C2’)) ((<Cell Sheet1.A1>, <Cell Sheet1.B1>, <Cell Sheet1.C1>), (<Cell Sheet1.A2>, <Cell Sheet1.B2>, <Cell Sheet1.C2>)) >>> for row in ws.iter_rows(‘A1:C2’): … for cell in row: … print cell <Cell… Read More »