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

Unable to run pdoc from command line #123

Closed
CadBrad opened this issue Feb 8, 2017 · 16 comments

Comments

Projects
None yet
8 participants
@CadBrad
Copy link

commented Feb 8, 2017

This question was closed in the past, but the solution didn't solve it for me. I'm running Windows 7 and python 2.7

I'm installing pdoc globally using "pip install pdoc". It says that it pip installs correctly, puts a file called 'pdoc' (no extension) into my Python27/Scripts (which is on my PATH), however when I type "pdoc" in the command line I get the following...
'pdoc' is not recognized as an internal or external command, operable program or batch file'

The previous closed issue was solved by running "pip install --system pdoc" but that was for Ubuntu and doesn't seem to be an option for Windows.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Feb 8, 2017

This isn't a problem with pdoc. You need to make sure Python27/Scripts is in your %PATH% environment variable. Alternatively, write out the full path: C:\foo\bar\Python27\Scripts\pdoc.exe.

@BurntSushi BurntSushi closed this Feb 8, 2017

@CadBrad

This comment has been minimized.

Copy link
Author

commented Feb 8, 2017

As I originally mentioned, Python27/Scripts is in my PATH.

You mention the full path ending in "pdoc.exe", however my pdoc doesn't have any extension and is just shown as "pdoc". Should pdoc have the extension .exe?

@BurntSushi BurntSushi reopened this Feb 8, 2017

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Feb 8, 2017

I guess it shouldn't have the .exe extension.

Honestly, I don't know. I don't use Windows, but given the error message, it seems like a Windows specific problem. I would suggest Googling around for how to install Python programs on Windows.

@robomojo

This comment has been minimized.

Copy link

commented Feb 18, 2017

the pdoc file is a python file. You should use it by running it with python and passing arguments.

C:\Python27\python.exe C:\Python27\Scripts\pdoc my_module.py
@CadBrad

This comment has been minimized.

Copy link
Author

commented Feb 22, 2017

When I run python pdoc my_module.py I get the error "python: can't open file 'pdoc': [Errno2] No such file or directory". Again, I confirmed pdoc is on my PATH.

Please bear in mind I've only tried doing pip install pdoc, and haven't tried to build from the source. I found another solution that was faster for my situation and didn't need to move forward with anymore troubleshooting.

I appreciate the software being opensource, and I hope by posting my installation issues it can help future Windows users who may experience this as well as the developers who may not have access to Windows environment for testing.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Feb 22, 2017

@CadBrad Another possibility is python -m pdoc my_module.py?

@CadBrad

This comment has been minimized.

Copy link
Author

commented Feb 22, 2017

That returns the following:
"C:\Python27\python.exe: No module named pdoc.main; 'pdoc' is a package and cannot be directly executed"

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Feb 22, 2017

@CadBrad OK, so at least Python knows about pdoc. Try python -c 'import pdoc; print pdoc.__path__. On my system:

$ python2 -c 'import pdoc; print pdoc.__path__'
['/home/andrew/.local/lib/python2.7/site-packages/pdoc']

Note the directory path. If I look in /home/andrew/.local/bin, then I can see that there is a file called pdoc. On your system, maybe it's pdoc.py. I don't know.

When I run python pdoc my_module.py I get the error "python: can't open file 'pdoc': [Errno2] No such file or directory". Again, I confirmed pdoc is on my PATH.

Note that whether pdoc is in your PATH or not has nothing to do with whether python pdoc works. python pdoc is trying to execute the file path pdoc, so you might need to specify python C:\Python\whatever\bin\pdoc for it to work.

Since you're on Windows, I think you're going to need to do a bit of debugging to figure out what file to execute. I just don't know how Python orients itself on Windows. If it helps, pdoc is configured using standard tooling, so there's nothing special going on. It's a normal Python command line tool.

@CadBrad

This comment has been minimized.

Copy link
Author

commented Feb 25, 2017

Alright I get an error when I run your command so I just entered the shell and typed the following
import pdoc
print pdoc.__path__

Which surprisingly worked!
I'm technically using an Anaconda distribution so it returned the path as C:\ProgramData\Anaconda2\lib\site-packages\pdoc

However, there is no bin folder. By searching in the Anaconda2 directory for anything called 'pdoc' the only additional files with the name of pdoc (outside of site-packages) are located in Anaconda2\Scripts. I'm actually very surprised i'm able to import pdoc from the python shell successfully and I'm not sure what to take away from this. It seems to recognize pdoc is installed, however not the command tool aspect of it??

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Feb 25, 2017

The fact that you're using Anaconda makes me even less familiar with what's going on, but it sounds like the pdoc file in Anaconda2/Scripts is exactly what you want. Why not try running it?

It seems to recognize pdoc is installed, however not the command tool aspect of it??

Both of the following things can be true:

  1. The pdoc package is installed correctly and known to python.
  2. Your shell environment is not configured properly and doesn't know where to find the pdoc command line tool.
@gemerden

This comment has been minimized.

Copy link

commented Jun 30, 2017

i cannot run it on windows (10) either (no anaconda), same problems, if i rename it to pdoc.exe, i get an error about not being compatible with 64-bit windows

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Jun 30, 2017

pdoc is a Python script, so it needs to be run with the Python interpreter. e.g., python path/to/pdoc.py (or similar). Renaming it to have a exe extension doesn't make any sense because it isn't a binary executable file.

@Kobzol

This comment has been minimized.

Copy link

commented Jul 26, 2017

Just run python <python_install_path>/Scripts/pdoc.

@stevebrasier

This comment has been minimized.

Copy link

commented Sep 28, 2017

see #127 (comment) - I'm on anaconda too and that fixes it

@sjpb sjpb referenced this issue Nov 6, 2017

Merged

Fix windows install #138

@Overdrivr

This comment has been minimized.

Copy link

commented Jan 15, 2018

I'm having the same issue, and I don't think it has something to do with Anaconda. The fix provided by @sjpb looks perfect for solving this.

@cortesi

This comment has been minimized.

Copy link
Member

commented Jun 3, 2018

This appears to be an issue with anaconda. Please re-open if you feel there's a pdoc bug.

@cortesi cortesi closed this Jun 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.