Cliff Wells wrote: > nerkles wrote: > > True it's a programming error, but it wouldn't hurt anything to have > > quickstart do an "idiot-check" on the name you give it. There are a lot > > of modules/components in Python, and quite a few components to TG > > itself that a new user/developer might not remember or even know > > about--either somebody new to Python and/or to TG. There will probably > > be a lot of people who are learning Python and TG at the same time. > > > > It would be helpful for the overall user experience if the thing called > > "quickstart" prevents you from creating a mess like that your first > > time out. Imagine a stream of errors being your first taste of TG! Most > > people would give up on it right then. And it wouldn't be difficult to > > implement. > > > > > > Perhaps a simple: > > try: > p = __import__(projectname) > assert False, "That name is already taken by an installed module" > except ImportError: > pass
Actually, it would need to be a bit more sophisticated than that, since it's a clash in project names, not module names that was the issue here. Something like: env = pkg_resources.Environment() if projectname in env: print projectname," is already in use by", for dist in env[projectname]: print dist; break Also, it'd be good to check PyPI for a matching name registration, but that's a bit more complex. The setuptools.package_index module can do it fairly easily, but it's slow due to needing to read the entire index in order to do case-insensitive matching. And of course it requires internet access.