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

Cannot do "python setup.py install" when in the same directory as setup.py #1

Closed
howejacob1 opened this issue Jun 14, 2013 · 6 comments
Assignees
Labels

Comments

@howejacob1
Copy link

This is because of the line chdir(dirname(file)). Since dirname(file) returns "" when in the same directory as setup.py, chdir takes "" and thus throws an exception.
Correct me if I'm wrong.

@Feneric
Copy link
Owner

Feneric commented Jun 14, 2013

You're probably right; at this stage I've only really used the packaging system to run the tests. I've got another check-in almost ready to go dealing with namespace handling. Hopefully I'll get that done by tomorrow. Afterwards I'll address the installation issue you're encountering. In the meanwhile, you don't really need to install anything... just reference the .py file as your Doxygen filter.

@ghost ghost assigned Feneric Jun 14, 2013
@Feneric
Copy link
Owner

Feneric commented Jun 16, 2013

I didn't seem to run into the same issue when I tried. Which platform did you use? Regardless I've applied a fix that ought to remove the issue you've described. Please let me know if it works for you.

@howejacob1
Copy link
Author

I just found out what works. I tried doing "python setup.py install" and that same error is thrown.
When I do ./setup.py install, it works. python --version gives "Python 2.7.3". I got this same behavior on my debian at work, and on my virtual debian on my personal computer (both wheezy).
I think I know why this is happening.
Consider this program:
#!/usr/bin/python
from future import print_function
import sys
print("argv: {}, file: {}".format(sys.argv[0], file))

I get this output:

jacob@debian:/documents/teledyne/argospd/rewrite/temp$ chmod a+x test.py
jacob@debian:
/documents/teledyne/argospd/rewrite/temp$ ./test.py
argv: ./test.py, file: ./test.py
jacob@debian:~/documents/teledyne/argospd/rewrite/temp$ python test.py
argv: test.py, file: test.py

Notice the ./test.py as opposed to the test.py, without the dot-slash. I would suppose that dir(file) would return the empty string when the program is invoked by "python test.py", and thus would throw an exception; This is consistent with my findings. But, it returns "." when the program is run like ./test.py . A simple test in the form
directory_name = dirname(file)
if directory_name: chdir(directory_name)
will do the trick. And sure enough, with that change, the program works.
testing if file is present doesn't do anything, because file will always, as a generalized boolean, be true, unless the file itself is named nothing (which may not be possible).
Correct me if I'm wrong.

@Feneric
Copy link
Owner

Feneric commented Jun 18, 2013

Ah, okay, thanks. That explains why I wasn't seeing it (I was executing it directly on all the platforms I was trying it on). As I couldn't reproduce it I tried to address the problem I thought you'd described, file returning an empty string. I'll try and tackle it today.

@howejacob1
Copy link
Author

Glad to help! Anything I can do to help the open source movement.

@Feneric
Copy link
Owner

Feneric commented Jun 19, 2013

I'm pretty sure it'll be fixed for you now as I was able to reproduce the problem and verify that it's gone.

@Feneric Feneric closed this as completed Jun 19, 2013
Feneric pushed a commit that referenced this issue Dec 22, 2017
merge commits into patch-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants