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

Circular reference on module import #71

Closed
tiktaalik-dev opened this issue Nov 29, 2015 · 7 comments
Closed

Circular reference on module import #71

tiktaalik-dev opened this issue Nov 29, 2015 · 7 comments
Assignees

Comments

@tiktaalik-dev
Copy link
Contributor

Hello there,

I'm experiencing an endless sequence of Import Errors because there's several circular references between base.py, codec.py, factory.py and mapping.py.

I'm at the end of my tether trying to make them work as they are so I reckon I'll just merge those files into one.

I'd recommend for you to rearrange the classes in a way that prevent this from happening.

Anyway, thanks for making available this library! :-)

Cheers,
Rodrigo Gambra

@whelks-chance
Copy link

Very old thread, but did you figure this out? Importing geojson is complaining about failing to find codecs, which imports geojson etc etc

There may be another conflict with django-geojson, which I'm also going in circles with.

@rayrrr
Copy link
Member

rayrrr commented Jul 16, 2019

If someone could post a gist/code snippet of exactly how this is happening, along with a note about the Python version being used, that would be helpful.

@rayrrr
Copy link
Member

rayrrr commented Jul 18, 2019

This is going to be fun.
geojson-circular-imports

@rayrrr rayrrr self-assigned this Jul 18, 2019
@tiktaalik-dev
Copy link
Contributor Author

Hey there,
Sorry for the very late reply to this thread. It has been in my mind but kept forgetting to reply before.
In the end what I did was to merge all the classes in a single file and that solved the problem. I was using Python 2.7 for that project so I didn't check if it worked fine in Python 3.

In case you may want to check my fix you can find it here (though bear in mind that's code from a version you made available 4 years ago):
https://github.com/doctortoffu/python-geojson/tree/simplified/simplified_version

Hope it helps, cheers.
Rigo.

@rayrrr
Copy link
Member

rayrrr commented Jul 25, 2019

@doctortoffu thanks! I was trying to reproduce this with Python 2.7 and the current version of geojson on PyPi (2.4.1) and was unable to do so. Although some circular refs still exist here, they do not seem to be causing ImportError exceptions any more...perhaps the issue was resolved since the version you experienced it with. I know it was a long time ago, but any chance you can reproduce this? Otherwise I am going to just close out this thread for now and handle circular ref removal during a future code cleanup effort.

@tiktaalik-dev
Copy link
Contributor Author

Hi @rayrrr,
My guess is that you guys probably solved this problem over this last 4 years, as I see that your code has 155 commits ahead since I forked it out :-)
I reckon you could close this thread for now. At some point I have to update the code of my project to use Python 3.7, which will require quite a bit of rewriting because of several libraries that were not migrated to Python 3. So when I do, I'll grab again a new version of your library and surely test how it goes.
Thanks again for this awesome library!

Cheers,
Rigo.

@rayrrr
Copy link
Member

rayrrr commented Jul 25, 2019

Good stuff, Rigo. geojson already supports Python 3.7 so you should be good to go when the time comes. Thanks for letting us know!

@rayrrr rayrrr closed this as completed Jul 25, 2019
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

3 participants