Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge_fixtures is having some problem parsing parameters with Python 3 #59

Open
fuzzydolphin opened this issue Sep 24, 2017 · 17 comments
Open

Comments

@fuzzydolphin
Copy link

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?

@Charl88
Copy link

Charl88 commented Nov 1, 2017

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.

@MaxBo
Copy link

MaxBo commented Jan 17, 2018

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
3027e39

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

@MaxBo
Copy link

MaxBo commented Jan 21, 2018

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

@davedash
Copy link
Owner

@fuzzydolphin do @MaxBo's changes help?

@seanchon
Copy link

seanchon commented Jun 6, 2018

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

@davedash davedash closed this as completed Jun 6, 2018
@agalazis
Copy link

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

@davedash
Copy link
Owner

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

@davedash davedash reopened this Oct 19, 2018
@agalazis
Copy link

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

@seanchon
Copy link

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

@davedash
Copy link
Owner

davedash commented Oct 19, 2018 via email

@florianm
Copy link

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

@mghantous
Copy link

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.

@davedash
Copy link
Owner

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

@mghantous
Copy link

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
Copy link

@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.

@davedash
Copy link
Owner

davedash commented Jul 15, 2020 via email

@mghantous
Copy link

mghantous commented Jul 15, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants