Ticket #13414 (confirmed Bug)

Opened 3 years ago

Last modified 3 years ago

Scripts work on 4.2.2, break down on 4.2.3

Reported by: tonim Owned by:
Priority: minor Milestone: 4.x
Component: Backend (Python) Version: 4.2
Keywords: Cc:

Description

I have a number of scripts that are generated via buildout:

[scripts]
recipe = zc.recipe.egg
eggs = ${secondary:eggs}
interpreter = zopepy
scripts = 
    zopepy
    importer
    ...

I use these scripts like so:

(virtualenv)$ ./bin/secondary run ./bin/scriptname -options /path/to/site

With 4.2.3, I get this error on all of them:

$ ./bin/secondary run bin/importer -l /03/mnt/Plone
Hold on to your hats folks, I'm a-patchin'
2013-01-18 00:15:25 WARNING PrintingMailHost 

******************************************************************************

Monkey patching MailHosts to print emails to the terminal instead of
sending them.

NO MAIL WILL BE SENT FROM ZOPE AT ALL!

Turn off debug mode or remove PrintingMailHost from the Products
directory to turn this off.

******************************************************************************

/path/to/eggs/Products.fatsyndication-1.0.1-py2.6.egg/Products/fatsyndication/config.py:16: DeprecationWarning: package_home is deprecated. import from App.Common instead
  from Globals import package_home
2013-01-18 00:15:25 WARNING ZODB.blob (4810) Blob dir /path/to/buildout/var/blobcache/ has insecure mode setting
/path/to/eggs/five.grok-1.2.0-py2.6.egg/five/grok/meta.py:29: DeprecationWarning: protectClass is deprecated. Please import from AccessControl.security
  from Products.Five.security import protectClass, protectName
/path/to/eggs/five.grok-1.2.0-py2.6.egg/five/grok/meta.py:29: DeprecationWarning: protectName is deprecated. Please import from AccessControl.security
  from Products.Five.security import protectClass, protectName
Usage: ./bin/instance run ./bin/interpreter [options] portal_path

interpreter: error: no such option: -c

Using PDB, I determined that this line in the "importer" script, which is being generated in ${buildout:directory}/parts/secondary/bin, suddenly fails to consume the options:

_options, _args = __import__("getopt").getopt(sys.argv[1:], 'ic:m:')

After that, _options has the whole line, and _args is empty. Continuing, that "-c" option hits my own options parser, which doesn't have a "-c" option. Pinning plone.recipe.zope2instance to 4.2.5 fixes the problem.

Change History

comment:1 Changed 3 years ago by kleist

  • Status changed from new to confirmed
  • Component changed from Unknown to Backend (Python)

comment:2 Changed 3 years ago by petschki

Just encountered the same problem with python 2.7.5, Plone 4.3.1, zopyx.plone.migration 0.2.8 using its importer script. pinning the version solves the problem indeed

Note: See TracTickets for help on using tickets.