django-fixture-magic icon indicating copy to clipboard operation
django-fixture-magic copied to clipboard

merge_fixtures is having some problem parsing parameters with Python 3

Open fuzzydolphin opened this issue 7 years ago • 17 comments

Using the following Python and Django

Python 3.4.6 Django 1.10.7

When I run the merge_fixtures command

python manage.py merge_fixtures foo.json bar.json baz.json > all_fixtures.json

It shows the following error message:

usage: manage.py merge_fixtures [-h] [--version] [-v {0,1,2,3}]
                                [--settings SETTINGS]
                                [--pythonpath PYTHONPATH] [--traceback]
                                [--no-color]
manage.py merge_fixtures: error: unrecognized arguments: foo.json bar.json baz.json

I looked into it a little bit and it seems to be unhappy in parsing the command line parameters. I think it is unhappy here:

        parser = self.create_parser(argv[0], argv[1])
        options = parser.parse_args(argv[2:])

But I am a bit unfamiliar with what is expected here and didn't have time to fully investigate the issue. Do you have a hint where I should be looking?

fuzzydolphin avatar Sep 24 '17 16:09 fuzzydolphin

You need to add the following line in the merge_fixtures.py file:

def add_arguments(self, parser): parser.add_argument('args', metavar='files', nargs='+', help='One or more fixture.')

You can see it in the latest commit on master, but it doesn't seem to have been updated on PyPi, unfortunately.

Charl88 avatar Nov 01 '17 09:11 Charl88

i faced the same problem with django-fixture-magic installed from pypi. When replaced it with the latest installation from github, it works fine. pip install --upgrade git+https://github.com/davedash/django-fixture-magic.git

I guess that the Pypi-Version is not updated yet, because your commit https://github.com/davedash/django-fixture-magic/commit/3027e39f4dc4fb09d5ed1a0a22f28c2438525598

did not update the version number. If you increase the version number in setup.py, PyPi might recognise, that there is an update.

MaxBo avatar Jan 17 '18 17:01 MaxBo

I added a similar add_arguments()-method to reorder_fixtures in Pull Request #61

MaxBo avatar Jan 21 '18 18:01 MaxBo

@fuzzydolphin do @MaxBo's changes help?

davedash avatar Jan 29 '18 17:01 davedash

I experienced a similar issue as @fuzzydolphin while running reorder_fixtures and incorporating @MaxBo's suggestion solved it for me.

seanchon avatar Jun 06 '18 00:06 seanchon

A year later and this is still an issue I wonder why this is even closed

agalazis avatar Oct 19 '18 17:10 agalazis

I misread that it was fixed by #61. Reopening but it won’t be fixed unless someone’s got a PR for this.

davedash avatar Oct 19 '18 17:10 davedash

@davedash it's all about releasing what you have in master to pypi :)

agalazis avatar Oct 19 '18 17:10 agalazis

PyPI deploy steps have changed slightly - https://stackoverflow.com/questions/45207128/failed-to-upload-packages-to-pypi-410-gone

seanchon avatar Oct 19 '18 17:10 seanchon

The weird steps I remembered from the last time I did this worked :)

https://pypi.org/project/django-fixture-magic/

I really outta put this in Travis Dave Dash

On Fri, Oct 19, 2018 at 11:01 AM Sean Chon [email protected] wrote:

PyPI deploy steps have changed slightly - https://stackoverflow.com/questions/45207128/failed-to-upload-packages-to-pypi-410-gone

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davedash/django-fixture-magic/issues/59#issuecomment-431446965, or mute the thread https://github.com/notifications/unsubscribe-auth/AADoaTCf02Tp9a2vhRC9iSxA58_sdOTdks5umhKggaJpZM4Ph8HN .

davedash avatar Oct 19 '18 18:10 davedash

Just ran into this error, confirmed it's fixed by using master:

pip install -e git+https://github.com/davedash/django-fixture-magic.git@master#egg=django_fixture_magic

 pip freeze | grep fixture
-e git+https://github.com/davedash/django-fixture-magic.git@466fa35c075009e4a1974f6e588471dd9e720e53#egg=django_fixture_magic

florianm avatar Apr 17 '19 00:04 florianm

I also confirmed that the source files from PyPi do not match the ones on github master. PyPi still contains the old buggy copy of merge_fixtures.py.

I did a diff of the PyPi package's merge_fixtures.py file vs the github master's merge_fixtures.py.

<     args = '[file ...]'
---
>
>     def add_arguments(self, parser):
>         parser.add_argument('args', metavar='files', nargs='+', help='One or more fixture.')

As a workaround, I would need to package the correct copy on an internal devpi server myself, because unfortunately I cannot use github in the environment I am working on.

mghantous avatar Jul 14 '20 15:07 mghantous

@mghantous Can you let me know if https://pypi.org/project/django-fixture-magic/0.1.5/ fixes things? This is from master.

davedash avatar Jul 15 '20 18:07 davedash

Hi @davedash you made me realize that I was actually on 0.1.3. I am unable to install 0.1.4 or 0.1.5. Maybe this is because I don't match requirements? But I thought it would be a different error message.

$ pip install django-fixture-magic==0.1.4
ERROR: Could not find a version that satisfies the requirement django-fixture-magic==0.1.4 (from versions: 0.0.2.macosx-10.6-i386, 0.1.4.macosx-10.13-x86_64, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.7, 0.0.8, 0.1.0, 0.1.1, 0.1.2, 0.1.3)
ERROR: No matching distribution found for django-fixture-magic==0.1.4

$ pip install django-fixture-magic==0.1.5
ERROR: Could not find a version that satisfies the requirement django-fixture-magic==0.1.5 (from versions: 0.0.2.macosx-10.6-i386, 0.1.4.macosx-10.13-x86_64, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.7, 0.0.8, 0.1.0, 0.1.1, 0.1.2, 0.1.3)
ERROR: No matching distribution found for django-fixture-magic==0.1.5

I'm using python 3.6 and django 2.2. Thanks.

mghantous avatar Jul 15 '20 18:07 mghantous

@davedash I think I may have identified the problem. If you navigate here you will see there is no 0.1.4 or 0.1.5 (but there is a version called 0.1.4.macosx-10.13-x86_64).

https://pypi.org/simple/django-fixture-magic/

I read in one article that you may need to do python setup.py bdist_wheel upload to get it to show up there.

mghantous avatar Jul 15 '20 19:07 mghantous

I uploaded a wheel version and tried locally to verify that it now works. DOes this work for you?

Dave Dash

On Wed, Jul 15, 2020 at 12:14 PM Matthew Ghantous [email protected] wrote:

@davedash https://github.com/davedash I think I may have identified the problem. If you navigate here you will see there is no 0.1.4 or 0.1.5 (but there is a version called 0.1.4.macosx-10.13-x86_64).

https://pypi.org/simple/django-fixture-magic/

I read in one article that you may need to do python setup.py bdist_wheel upload to get it to show up there.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davedash/django-fixture-magic/issues/59#issuecomment-658954164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOQ2O4SKAQAI76YBHMKEDR3X5X3ANCNFSM4D4HYHGQ .

davedash avatar Jul 15 '20 19:07 davedash

Yes. And it appears merge_fixtures.py is the correct version off of master now. Thank you very much!

I am pretty sure this issue can be closed now.

mghantous avatar Jul 15 '20 19:07 mghantous