Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global paster command not found in virtualenv

I created a custom paster command as described in http://pythonpaste.org/script/developer.html#what-do-commands-look-like. In my setup.py I have defined the entry point like this:

entry_points={
  'paste.global_paster_command' : [
    'xxx_new = xxxconf.main:NewXxx'
  ]
}

I'm inside an activated virtualenv and have installed my package via

python setup.py develop

If I run paster while inside my package folder, I see my custom command and I can run it via paster xxx .... But if I leave my package folder paster does not display my command anymore. I checked which paster and it's the version of my virtualenv. I also started a python interpreter and imported xxxconf and it works fine.

I have no idea why my global command is not recognized when I'm outside my package folder!?

like image 246
Achim Avatar asked Dec 30 '12 21:12

Achim


People also ask

Is virtualenv installed in/usr/local/bin?

The virtualenv is indeed installed in /usr/local/bin, but whenever I try to run the virtualenv command, the command is not found. I've also tried to run the virtualenv command in the directory /usr/local/bin, and it gives me the same result: Any workarounds for this? Why is this the case? Show activity on this post.

How to fix ‘command not found’ error on virtualenv?

How to Fix ‘Command Not Found’ Error on Virtualenv? If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

How to install “virtual ENV” with “apt-get” command?

In some cases, installing with the “pip” command doesn’t yield positive results. Therefore, in this step, we will be installing “virtual env” with the “APT-GET” Command. For that: Click on the “ Spotlight Glass ” in the top right corner. Type in “ Terminal ” and select the first option. Type in the following command and press “ Enter “.

Why can't I install virtualenv on my System?

If there's no auto-completion install virtualenv on your system by running: Show activity on this post. In this case, at first you need to uninstall the pipenv and then install again using sudo command.


1 Answers

You are doing something wrong, it should work. This is the minimal working example, you can test it with your virtualenv:

blah/setup.py:

from setuptools import setup, find_packages

setup(name='blah',
      version='0.1',
      packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
      include_package_data=True,
      zip_safe=False,
      entry_points={'paste.global_paster_command': [ "xxx_new = blah.xxx:NewXxx", ] },
      )

blah/blah/xxx.py:

from paste.script import command

class NewXxx(command.Command):
    usage = "PREFIX"
    summary = "some command"
    group_name = "my group"

blah/blah/__init__.py: empty.

Now testing:

$ pwd
/tmp
$ virtualenv paster
New python executable in paster/bin/python
Installing setuptools............done.
Installing pip...............done.
$ . paster/bin/activate
(paster)$ pip install PasteScript
Downloading/unpacking PasteScript
[... skipping long pip output here ...]
(paster)$ paster
[...]
Commands:
  create       Create the file layout for a Python distribution
  help         Display help
  make-config  Install a package and create a fresh config file/directory
  points       Show information about entry points
  post         Run a request for the described application
  request      Run a request for the described application
  serve        Serve the described application
  setup-app    Setup an application, given a config file

(paster)$ cd blah/
(paster)$ python setup.py develop
running develop
[... skipping setup.py output...]
(paster)$ paster
[...]
Commands:
  create       Create the file layout for a Python distribution
  help         Display help
  make-config  Install a package and create a fresh config file/directory
  points       Show information about entry points
  post         Run a request for the described application
  request      Run a request for the described application
  serve        Serve the described application
  setup-app    Setup an application, given a config file

my group:
  xxx_new      some command
(paster)$ cd ~
(paster)$ paster
[...]
Commands:
[...]
  setup-app    Setup an application, given a config file

my group:
  xxx_new      some command
like image 177
abbot Avatar answered Sep 21 '22 17:09

abbot