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

fix python3 compat issue #10

Closed
wants to merge 1 commit into from
Closed

fix python3 compat issue #10

wants to merge 1 commit into from

Conversation

Stranger6667
Copy link

I found an NameError on Python 3.3.2, and propose small change to fix it.

@Stranger6667
Copy link
Author

Ooops, I missed #4 ...

Bouke added a commit to Bouke/djangobench that referenced this pull request Nov 13, 2013
Removed Unipath dependency as it claims to support Python 3, but has an open
issue regarding Python 3 support <mikeorr/Unipath#10>.

Removed argparse dependency as Python 2.7 and 3.2 included argparse in stdlib.

Furthermore some PEP8 cleanups on the files touched.
@ulope
Copy link

ulope commented Apr 2, 2014

Too bad this hasn't been merged yet.

However I would suggest that you invert the logic in your version test. Instead of testing for Python 3 test for 2. That way an eventual Python 4 will not break.

@mikeorr
Copy link
Owner

mikeorr commented Apr 4, 2014

I didn't see this issue somehow. I thought the Python 3 work was done. I'll add it to my todo list. I'm also looking at a version of Unipath on top of the new pathlib. However, the last time I looked at the pathlib on PyPI it wasn't up to date with the version in Python 2.4.

@aaronlelevier
Copy link

I am getting this error when running "import unipath" in Python 3.4.0:

_base = os.path.supports_unicode_filenames and unicode or str
NameError: name 'unicode' is not defined

Is this a compatibility issue, or I need to import something else, for unicode to be recognized?

Thanks,
Aaron

@mikeorr
Copy link
Owner

mikeorr commented Apr 6, 2014

See #4. 'unicode' doesn't exist in Python 3. I haven't yet looked to see why my unit tests didn't catch this.

Bouke added a commit to Bouke/djangobench that referenced this pull request Apr 13, 2014
Removed Unipath dependency as it claims to support Python 3, but has an open
issue regarding Python 3 support <mikeorr/Unipath#10>.

Removed argparse dependency as Python 2.7 and 3.2 included argparse in stdlib.

Furthermore some PEP8 cleanups on the files touched.
@mikeorr
Copy link
Owner

mikeorr commented Jan 5, 2015

Fixed in 5f5dfdf. Details in issue 16.

Your code is better than mine was but it has one flaw: if the 'except' stanza executes and os.path.supports_unicode_filenames is false, it will set _base to False. That's because there's no "or" part in the "and ... or ..." expression. I think what you want there is just _base = str.

@mikeorr mikeorr closed this Jan 5, 2015
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

Successfully merging this pull request may close these issues.

None yet

4 participants