How come I cannot run satchmo_check? - python

I'm stuck on step 1 of test and install the data here: http://www.satchmoproject.com/docs/dev/settings.html
When I try to run the command, I get the following error:
(pyweb27)user#mint ~/Documents/workspace/python/site $ python manage.py satchmo_check
Unknown command: 'satchmo_check'
Type 'manage.py help' for usage.
I do have satchmo installed:
(pyweb27)user#mint ~/Documents/workspace/python/site $ python
Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django; import satchmo_store;
>>> satchmo_store.get_version()
'0.9.3-pre hg-2553:76b7dccafc76'
Am I doing something wrong? How can I resolve this?

Related

Is it a bug of os.path.abspath to translate '~/path'?

See below:
$ python3
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.abspath('~/gitlab')
'/home/swift/gitlab/swift_test_code/swift/core/~/gitlab'
>>> os.path.expanduser('~/gitlab')
'/home/swift/gitlab'
Does anyone know why abspath doesn't expand ~ as the home directory? It's tricky to call expand before calling abspath.

Psycopg2: psycopg2.connect() in Python has no result

I want to connect to a PostgreSQL database in python with Psycopg2, but when I run the connecting command, I get no results and no errors, and I can't get what's the problem.
Here is what I have in my terminal:
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>> conn = psycopg2.connect("host=192.20.0.4 port=5432 user=mary
password=123456 dbname=reports")
It stops in this step, it doesn't go to the next line so that I can run any other commands, and doesn't print any errors or results, what should I do? what is the problem?

vagrant/ansible: ImportError: No module named site

I am trying to start a vagrant vm and provision it using its ansible provisioner;
config.vm.provision "ansible" do |ansible|
ansible.limit = "all"
ansible.compatibility_mode = "2.0"
ansible.playbook = "ansible/install.yml"
end
the box is ubuntu/xenial64
Provisioning fails as follows:
==> default: Running provisioner: ansible...
default: Running ansible-playbook...
ImportError: No module named site
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
Host is Ubuntu 16.04.05 with ansible 2.7.0
I even tried to run a shell provisioner that installs python-minimal on the guest before executing ansible, but with no luck.
edit: in the mean time, on my controller:
/home/pkara/Desktop
$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>>
/home/pkara/Desktop
$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>>

libsvm on linux - how to add path

I downloaded the tar file for libsvm, navigated to the python directory and ran the make command. This words and when I run python inside that same directory,
import svm
works just fine. But not in any other directory. What can I do to make this library accessible from any where? I know it has some thing to do with copying the path some where, but not sure since I'm a newbie at linux.
what linux distro are you on? on my Ubunto I just:
$ sudo apt-get install python-libsvm
...
$ python
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import svm
>>>
$ cd /tmp
$ python
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import svm
>>>

Adding a shebang causes No such file or directory error when running my python script

I'm trying to run a python script. It works fine when I run it:
python2.5 myscript.py inpt0
The problem starts when I add a shebang:
#!/usr/bin/env python2.5
Result in:
$ myscript.py inpt0
: No such file or directory
Try 2:
#!/usr/local/bin/python2.5
Result in:
$ myscript.py inpt0
: bad interpreter: No such file or directoryon2.5
When I run them directly in the terminal they both work just fine:
$ /usr/local/bin/python2.5
Python 2.5.4 (r254:67916, Feb 9 2009, 12:50:32)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ /usr/bin/env python2.5
Python 2.5.4 (r254:67916, Feb 9 2009, 12:50:32)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Any hints on how to make this work with shebang?
I had similar problems and it turned out to be problem with line-endings. You use windows/linux/mac line endings?
Edit: forgot the script name, but as OP says, it's dos2unix <filename>

Categories