installed new version of python, but django still uses system default - python

On Dreamhost, I did the following
installed Python 2.7.1 in my ~/opt directory,
added export PATH=$HOME/opt/bin/:$PATH in my .bash_profile
verified with python --version that 2.7.1 was default
installed setuptools 0.6c11-py2.7
installed Django 1.2.4 with /path/to/python2.7 setup.py install
verified version 1.2.4 with import django and django.VERSION in python shell
wget http://wiki.dreamhost.com/django-setup.py
python2.7 django-setup.py in my site directory ("site.com")
intentionally put a syntax error in ~/site.com/project/urls.py
visited the site in web browser and the error page still says I'm using Python 2.5.2
Why does my Django refuse to use my new version of Python?
According to this, installing-django-with-python-2-5-and-not-with-the-default-version-of-python, the problem might be with mod_wsgi (or I think passenger in my case (but I don't actually know if they do the same thing)).
Should I try to compile mod_wsgi, compile passenger_wsgi, install virtualenv, all of the above, none of the above, A and C, B D and E, or something else altogether?

Maybe you can change the WSGIPythonExecutable directive in your mod_wsgi configuration?
To configure Passenger's Python interpretter, you can follow these steps.

Related

Robot Framework with Pycharm -- Autocomplete doesn't work

I've installed PyCharm with the robotframework support plugin.
The .robot files are identified successfully and I was able to create a simple script and run it in pyCharm.
However, my problem is that no keywords nor even the robotframework libraries (selenium2library) are recognized by pycharm in order to be autocompleted when typing them.
I also have the intellibot plugin installed.
Is there something that I'm missing? Is there another configuration file somewhere?
Thanks,
Try to set up your Library to robotframework-selenium2library == 1.8.0, then the issue will disappear.
If you have the last version it doesn't work for me.
My solution:
Uninstall the 'Robot framework support' (PyCharm/File/Settings/Plugins)
Uninstall 'Intellibot' (PyCharm/File/Settings/Plugins) (Uninstall all similar plugins!)
Exit PyCharm
Uninstall robotframework-seleniumlibrary (Open command prompt with administration mode: pip uninstall robotframework-seleniumlibrary)
Install robotframework-seleniumlibrary 3.3.1 (Command prompt: pip install robotframework-seleniumlibrary==3.3.1)
Open PyCharm
Install 'IntelliBot #SeleniumLibrary Patched' (PyCharm/File/Settings/Plugins)
(If it isn't working then try the following: PyCharm/File/Invalidate Caches/Restart... and click the 'Invalidate and Restart')
There is a bug in the intellibot plugin.
To resolve you need to
1. Uninstall your current intellibot plugin
2. Search for "IntelliBot #SeleniumLibrary Patched" in the plugins repository.
3. Install this patched plugin.
This worked for me.
You can try install "Robot Framework support" plugin.
it working for me.
use plugin Intellbot#SeleniumLibrary Patched
and robotframework-seleniumlibrary version 3.3.1
It works for me after lot of research from the internet
I recomend to use lte2000 fork: https://github.com/lte2000/intellibot
It works fine for me (Pycharm 2020.1, Robot Framework 3.2.2 and SeleniumLibrary 4.5.0)
In our main_resources.robot we need to give file path as below for the library files which contain definition of function
Library ../lib/SampleRest/SampleRest.py
When you do cntl+click on above SampleRest.py it should be navigated to that file
Your SampleRest.py should contain all your function definitions as below
try:
from .api import *
except:
from api import *
class SampleRest(
events,
repository,
devices
):
"""
This library will provides keywords to automating the cloud test cases
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = 1.0
def __init__(self):
for base in SampleRest.__bases__:
base.__init__(self)
Once I declare this I can use any of functions present in above devices.py file from robot file and it will be successfully navigated
Also please check your robotframework-seleniumlibrary version it should be 3.3.1 because for latest version navigation is an issue
I have been troubled by this for what seems to be forever.
Here are my configuration steps, and so far everything is working like a charm.
My setup:
Installed Python 3.9.x => added path to variables in "windows environment Variables" Check python and pip versions.
install selenium
install robotframework
install robotframework-seleniumlibrary
Install Pycharm and set Interpreter to Python 3.9.x
Install Plugin: "IntelliBot #SeleniumLibrary Patched" - Do not install Selenium2Library This is what causes the IDE issues.
Restart IDE and enjoy. And for those just getting into Robotframework, dont forget to add webdrivers.
For this I made a folder in root (called it webdrivers) and also added this to my Windows Enviro variables. This allows me to call them from any project folder.
I am going through the same problems... I've tried IntelliBot, IntelliBot #patched, Robot Framework Support plugins.
Now I am testing the Hyper RobotFramework Support plugin [link] and for now, looks the best from all of these.
With it I have some auto-complete support, also ctrl+click (navigation) works nice (better than in IntelliBot). Not perfect, but the best it has been so far.
I have installed:
PyCharm 2021.3.2
Python 3.10.2
Robot Framework 4.1.3
selenium 4.1.3
robotframework-seleniumlibrary 6.0.0
(on windows you can run the command pip list to see the version of the libraries that have been installed using pip)

BitNami DjangoStack not 'self contained', cannot run application

I installed the Windows (32bit) BitNami DjangoStack 1.4.1.0 and elected not to install the python that came with it as I already have Python 2.7 installed.
I got the error below and also an internal server error when I clicked on the button in the introduction web page (so Appache is running ok)
enter code here
[error] mod_wsgi (pid=3990): Target WSGI script '/opt/bitnami/apps/django/scripts/django.wsgi' cannot be loaded as Python module
I found a similar question but that related to installing on Amazon. Also following through the answers it appeared that the problem is that the wsgi had been compiled against the wrong python version.
I then uninstalled BitNami and re-installed using the python version that was provided - still the same message.
I don't see how the wrong python version can be the problem if the BitNami package is self contained, i.e. comes with all the bits needed to run.
In case my previously installed version was causing the problem I remove it from the PATH environment variable.
Also the documentation for Windows seems wrong. django.conf and django.wsgi are not where the docs say they are (\Users\user\BitNami SDjangoStack projects\apps). In fact the only thing in that directory is the new project I selected on installation - no apps directory. I found the files in the BitNami directories.
Also when I typed python in the BitNami console I got python 2.7.3, not 2.7.2 which is listed in the installation guide.
I thought this package would be wonderful to help me get a production Django site running. It is now ready in the development phase to go live for testing.
What do you exactly mean with not installing Python? BitNami DjangoStack is self contained in the sense that it includes its own Python and its dependecies. Also you mentioned that you are running it on Windows but the path /opt/bitnami is the default path when installing as root in Linux. What exact options did you select during the installation?

Error: No module named staticfiles in django 1.3.1 + python 2.6? what's wrong

I didn't worked on the django project for somedays and now I return and I can't work on it. When I debug or run in eclipse aptana I get the "Error: No module named staticfiles" error.
I have even updated aptana to today's updates and no luck.
I have uninstalled the django, delete all files and reinstall.
If I import django with python in cmd (on windows) it is in the place I expect to be
But if I delete the "'django.contrib.staticfiles'," string in the "INSTALLED_APPS" from settings.py everything works fine but I have no access to the static files, as expected..
In those days I have installed Google app engine + python 2.5; can this be the problem and how to solve?
thank you very much*
Here are the steps I'd take to find out the problem:
verify that it's working correctly in the command-line (cmd.exe in windows) - just to remove the issues associated with Aptana. You need to do something like: C:\Path\to\Python2.6\python.exe manage.py runserver (NB: choose any management command that will check your settings.py). If this gives the same error, then you haven't got Django 1.3.1 installed in Python2.6 (you could install it, or you could set up a fresh virtualenv, see below)
once you've got it working in the command line, you just have to make sure that aptana is using the correct interpreter path. You need to check that you've defined it correctly (in your global preferences (the workspace settings) -- pydev python interpreter) and then are using it in the specific project -- (check the project settings that it is using the python interpreter you just defined )
NB: Django 1.3.1 can use python2.5, but not next version of django
Here is how I would avoid this in future:
use virtualenv[1] to avoid being dependent on the arbitrary nature of your installation history (once you've installed virtualenv in ANY version of python you can then specify which python when you set up the virtualenv: virtualenv -p C:\Path\to\Python2.6\python.exe ).
use virtualenv --no-site-packages to ensure you have no dependencies locally
use pip[2] to install all your python packages (problems may occur with packages with binary content - use easy_install for those)
use pip freeze > requirements.txt to record your dependencies (and add this file into your source code control)
[1] http://pypi.python.org/pypi/virtualenv
[2] http://pypi.python.org/pypi/pip
NB pip and easy_install are automatically installed into your new virtualenv
use {% load static %} instead of {% load staticfiles %}
in the new version of Django, the syntax of loading static files changed

Apache Config - Multiple python versions

I have a couple versions of python on my box. My app uses python 2.7 which is found in /usr/local/bin/python. Apache seems to be using an earlier version in /usr/bin/python. How can I configure Apache to use a later version of Python for my app?
To use with Python 3, you need to install the right mod_wsgi for python 3.
On Debian or Ubuntu : sudo apt-get install libapache2-mod-wsgi-py3.
For older versions of Python, when installing mod_wsgi, type : ./configure --with-python=/usr/local/bin/python2.5 for version 2.5 for instance.
You can't. Either rebuild mod_wsgi against the other version of Python, or change the shebang line in your CGI scripts to the other executable.
I could be mistaking, but whatever user apache is started with has a profile which likely has the search path in it. You could change the search path to search /usr/local/bin before /usr/bin, though this is not an ideal approach. Whatever default shell is set for the account used by Apache, just check that you have an rc-file for that shell, and if not, create one.

Install Trac on 64bits Windows 7

I'm configuring a new Developing Server that came with Windows 7 64bits.
It must have installed Trac with Subversion integration.
I install Subversion with VisualSVN 2.1.1, clients with TortoiseSVN 1.6.7 and AnkhSVN 2.1.7 for Visual Studio 2008 SP1 integration.
All works fine! my problem begun when going to Trac installation.
I install python 2.6 all fine.
Trac hasn't a x64 windows installer, so I installed it manually by compiling it with python console (C:\Python26\python.exe C:/TRAC/setup.py install).
After that, I can create TRAC projects normally, the Trac core is working fine. And so the problem begins, lets take a look at the Trac INSTALL file:
Requirements
To install Trac, the following software packages must be installed:
Python, version >= 2.3.
Subversion, version >= 1.0. (>= 1.1.xrecommended)
Subversion SWIG Python bindings (not PySVN).
PySQLite,version 1.x (for SQLite 2.x) or version 2.x (for SQLite 3.x)
Clearsilver, version >= 0.9.3 (0.9.14 recommended)
Python: OK
Subverion: OK
Subversion SWIG Python bindings (not PySVN):
Here I face the first issue, he asks me for 'cd' to the swig directory and run the 'configure' file, and the result is:
C:\swigwin-1.3.40> c:\python26\python.exe configure
File "configure", line 16
DUALCASE=1; export DUALCASE # for MKS sh
^
SyntaxError: invalid syntax
PySQLite, version 1.x (for SQLite 2.x) or version 2.x (for SQLite 3.x):
Don't need, as Python 2.6 comes with SQLLite
Clearsilver, version >= 0.9.3 (0.9.14 recommended):
Second issue, Clearsilver only has 32bit installer wich does not recognize python installation (as registry keys are in different places from 32 to 64 bits).
So I try to manually install it with python console. It returns me a error of the same kind as SWIG:
C:\clearsilver-0.10.5>C:\python26\python.exe ./configure
File "./configure", line 13
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
^
SyntaxError: invalid syntax
When I simulate a web server using the "TRACD" command, it runs fine when I disable svn support but when I try to open the web page it shows me a error regarding ClearSilver is not installed for generating the html content.
AND (for making me more happy) This TRAC will run over IIS7, I mustn't install Apache...
I'm nearly crazy with this issue... HELP!!!
Just export Register from [HKEY_LOCAL_MACHINE\SOFTWARE\Python] to [HKEY_CURRENT_USER\Software\Python].
It's happens because trac only see the [HKEY_CURRENT_USER\Software\Python] and you installed the python "For all users"
I would expect that Trac on Windows instructions should work on x64, even if they're 32-bit packages. Have you tried this and failed?
Subversion SWIG Python bindings:
configure is not meant to be run by Python; it's meant to be run with a POSIX sh, like Bash or ksh. However, if you read subversion/bindings/swig/INSTALL you'll find that the installation instructions for Windows do not use configure; instead, Visual Studio and gen-make.py are used.
Note that your bindings should match your installed Subversion.
Clearsilver:
Likewise, configure is meant for a sh, not Python. Clearsilver compilation instructions for Windows can be found in clearsilver/python/README.txt.
Looks like I'm not the only one trying to install Trac on Win 7 64-bit, only to see the install crash and burn.
One problem is the lack of installed registry entries for Python on Win x64, which I was able to find via a web search. The problem was identified months ago, but unfortunately no patch release has been made available.
I was almost ready to give up on Trac, but the information here has given me new hope. Thanks all!

Categories

Resources