Coder Social home page Coder Social logo

--html works but --http doesn't about pdoc HOT 4 CLOSED

pdoc3 avatar pdoc3 commented on September 22, 2024
--html works but --http doesn't

from pdoc.

Comments (4)

kernc avatar kernc commented on September 22, 2024

After git clone, I ran pip install -e . in the plotly_express directory. Can't seem to reproduce the issue:

$ pdoc plotly_express --http localhost:8080 
Starting pdoc server on localhost:8080
pdoc server ready at http://localhost:8080
127.0.0.1 - - [17/Feb/2019 16:33:30] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [17/Feb/2019 16:33:32] "GET /plotly_express HTTP/1.1" 302 -
127.0.0.1 - - [17/Feb/2019 16:33:32] "GET /plotly_express/ HTTP/1.1" 200 -
127.0.0.1 - - [17/Feb/2019 16:33:42] "GET /plotly_express/colors/index.html HTTP/1.1" 302 -
127.0.0.1 - - [17/Feb/2019 16:33:42] "GET /plotly_express/colors/ HTTP/1.1" 200 -
127.0.0.1 - - [17/Feb/2019 16:33:50] "GET /plotly_express/colors/diverging.html HTTP/1.1" 200 -

If I don't install plotly_express, I get the following error:

Exception happened during processing of request from ('127.0.0.1', 46388)
Traceback (most recent call last):
  File "/home/user/pdoc/pdoc/__init__.py", line 540, in import_module
    module.__loader__.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/tmp/plotly_express/plotly_express/_px.py", line 5, in <module>
    from .colors.qualitative import Plotly as default_qualitative_seq
SystemError: Parent module 'plotly_express' not loaded, cannot perform relative import

But this is due to pdoc importing the documented module, plotly_express using relative imports, and Python not honoring relative imports from non-packages (i.e. filesystem paths).

from pdoc.

nicolaskruchten avatar nicolaskruchten commented on September 22, 2024

Right, I was trying this without installing locally. I guess this is just not a supported use case?

from pdoc.

kernc avatar kernc commented on September 22, 2024

I see. The discrepancy between --html (which even without installing works) and --http (which doesn't) was unintended. Looking into it.

from pdoc.

kernc avatar kernc commented on September 22, 2024

It has to do with these lines

pdoc/pdoc/cli.py

Lines 333 to 334 in 53544d8

# Support loading modules specified as python paths relative to cwd
sys.path.append(os.getcwd())

I guess we can just move them a few lines up ...

from pdoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.