Python Tornado AttributeError: module 'test' has no attribute '__path__'





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I am attempting to just run the Hello World code from Tornado docs



import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")

def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])

if __name__ == "__main__":
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()


Except I am getting an error: AttributeError: module 'test' has no attribute '__path__'



I am just using IDLE to run test.py



I thought this was due to my Windows 10 computer not having Python accessible to PATH but even with adding in the python 3.6 to PATH I am still getting the same error. Any ideas?



The screenshot is how I added python to PATH and I think I got it correct..



enter image description here



------EDIT------



Ill add some screenshots of the errors/tracebacks I am running into. 1st one is the command prompt below when the test.py is ran in IDLE 3.6 in Windows 10.



enter image description here



If there is an import error, I can import Tornado just fine thru IDLE interpreter.
enter image description here



I also tried running this hello World code in IPython 3.7, and I get this error:
enter image description here










share|improve this question

























  • Please post the full error traceback.

    – xyres
    Jan 4 at 6:00











  • Can you give me a tip on how to do a full error trace back?

    – HenryHub
    Jan 4 at 8:47











  • Post the full error message that you're getting.

    – xyres
    Jan 4 at 9:14













  • I added some screenshots

    – HenryHub
    Jan 4 at 16:09











  • Odd in Ipython even restarting the kernel & rerunning the code the same error always popped up the loop was running

    – HenryHub
    Jan 4 at 16:25


















0















I am attempting to just run the Hello World code from Tornado docs



import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")

def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])

if __name__ == "__main__":
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()


Except I am getting an error: AttributeError: module 'test' has no attribute '__path__'



I am just using IDLE to run test.py



I thought this was due to my Windows 10 computer not having Python accessible to PATH but even with adding in the python 3.6 to PATH I am still getting the same error. Any ideas?



The screenshot is how I added python to PATH and I think I got it correct..



enter image description here



------EDIT------



Ill add some screenshots of the errors/tracebacks I am running into. 1st one is the command prompt below when the test.py is ran in IDLE 3.6 in Windows 10.



enter image description here



If there is an import error, I can import Tornado just fine thru IDLE interpreter.
enter image description here



I also tried running this hello World code in IPython 3.7, and I get this error:
enter image description here










share|improve this question

























  • Please post the full error traceback.

    – xyres
    Jan 4 at 6:00











  • Can you give me a tip on how to do a full error trace back?

    – HenryHub
    Jan 4 at 8:47











  • Post the full error message that you're getting.

    – xyres
    Jan 4 at 9:14













  • I added some screenshots

    – HenryHub
    Jan 4 at 16:09











  • Odd in Ipython even restarting the kernel & rerunning the code the same error always popped up the loop was running

    – HenryHub
    Jan 4 at 16:25














0












0








0








I am attempting to just run the Hello World code from Tornado docs



import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")

def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])

if __name__ == "__main__":
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()


Except I am getting an error: AttributeError: module 'test' has no attribute '__path__'



I am just using IDLE to run test.py



I thought this was due to my Windows 10 computer not having Python accessible to PATH but even with adding in the python 3.6 to PATH I am still getting the same error. Any ideas?



The screenshot is how I added python to PATH and I think I got it correct..



enter image description here



------EDIT------



Ill add some screenshots of the errors/tracebacks I am running into. 1st one is the command prompt below when the test.py is ran in IDLE 3.6 in Windows 10.



enter image description here



If there is an import error, I can import Tornado just fine thru IDLE interpreter.
enter image description here



I also tried running this hello World code in IPython 3.7, and I get this error:
enter image description here










share|improve this question
















I am attempting to just run the Hello World code from Tornado docs



import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")

def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])

if __name__ == "__main__":
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()


Except I am getting an error: AttributeError: module 'test' has no attribute '__path__'



I am just using IDLE to run test.py



I thought this was due to my Windows 10 computer not having Python accessible to PATH but even with adding in the python 3.6 to PATH I am still getting the same error. Any ideas?



The screenshot is how I added python to PATH and I think I got it correct..



enter image description here



------EDIT------



Ill add some screenshots of the errors/tracebacks I am running into. 1st one is the command prompt below when the test.py is ran in IDLE 3.6 in Windows 10.



enter image description here



If there is an import error, I can import Tornado just fine thru IDLE interpreter.
enter image description here



I also tried running this hello World code in IPython 3.7, and I get this error:
enter image description here







python path tornado






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 4 at 16:09







HenryHub

















asked Jan 3 at 22:13









HenryHubHenryHub

471319




471319













  • Please post the full error traceback.

    – xyres
    Jan 4 at 6:00











  • Can you give me a tip on how to do a full error trace back?

    – HenryHub
    Jan 4 at 8:47











  • Post the full error message that you're getting.

    – xyres
    Jan 4 at 9:14













  • I added some screenshots

    – HenryHub
    Jan 4 at 16:09











  • Odd in Ipython even restarting the kernel & rerunning the code the same error always popped up the loop was running

    – HenryHub
    Jan 4 at 16:25



















  • Please post the full error traceback.

    – xyres
    Jan 4 at 6:00











  • Can you give me a tip on how to do a full error trace back?

    – HenryHub
    Jan 4 at 8:47











  • Post the full error message that you're getting.

    – xyres
    Jan 4 at 9:14













  • I added some screenshots

    – HenryHub
    Jan 4 at 16:09











  • Odd in Ipython even restarting the kernel & rerunning the code the same error always popped up the loop was running

    – HenryHub
    Jan 4 at 16:25

















Please post the full error traceback.

– xyres
Jan 4 at 6:00





Please post the full error traceback.

– xyres
Jan 4 at 6:00













Can you give me a tip on how to do a full error trace back?

– HenryHub
Jan 4 at 8:47





Can you give me a tip on how to do a full error trace back?

– HenryHub
Jan 4 at 8:47













Post the full error message that you're getting.

– xyres
Jan 4 at 9:14







Post the full error message that you're getting.

– xyres
Jan 4 at 9:14















I added some screenshots

– HenryHub
Jan 4 at 16:09





I added some screenshots

– HenryHub
Jan 4 at 16:09













Odd in Ipython even restarting the kernel & rerunning the code the same error always popped up the loop was running

– HenryHub
Jan 4 at 16:25





Odd in Ipython even restarting the kernel & rerunning the code the same error always popped up the loop was running

– HenryHub
Jan 4 at 16:25












1 Answer
1






active

oldest

votes


















0














Solution: Run your file without the -m argument.



Another solution would be to provide the file name without the .py extension:



python -m test


This will also work.





Explanation:



The -m argument tells Python to run a module (file) present in the Python path. It doesn't take the name of the file, it takes the name of the module. The difference is that the file name contains .py suffix, whereas the module name doesn't.



So you can run the test.py file like this, too: python -m test.





When to use -m argument:



The -m argument is there for convenience. For example, if you want to run python's default http server (which comes with python), you'd write this command:



python -m http.server


This will start the http server for you. The convenience that -m argument gives you is that you can write this command from anywhere in your system and python will automatically look for the package called http in your the system's Path.



Without the -m argument, if you wanted to run the http server, you'd have to give it's full path like:



python C:pathtopythoninstallationhttpserver.py


So, -m argument makes it easy to run modules (files) present in the Path.






With Tornado would you happen to know how to kill the Python interpreter? A CNTRL-C doesn't do anything.




I use Linux and Ctrl-C works fine for me. On Windows you can try Ctrl-D or Ctrl-Z. Or here are some answers: Stopping python using ctrl+c






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030519%2fpython-tornado-attributeerror-module-test-has-no-attribute-path%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Solution: Run your file without the -m argument.



    Another solution would be to provide the file name without the .py extension:



    python -m test


    This will also work.





    Explanation:



    The -m argument tells Python to run a module (file) present in the Python path. It doesn't take the name of the file, it takes the name of the module. The difference is that the file name contains .py suffix, whereas the module name doesn't.



    So you can run the test.py file like this, too: python -m test.





    When to use -m argument:



    The -m argument is there for convenience. For example, if you want to run python's default http server (which comes with python), you'd write this command:



    python -m http.server


    This will start the http server for you. The convenience that -m argument gives you is that you can write this command from anywhere in your system and python will automatically look for the package called http in your the system's Path.



    Without the -m argument, if you wanted to run the http server, you'd have to give it's full path like:



    python C:pathtopythoninstallationhttpserver.py


    So, -m argument makes it easy to run modules (files) present in the Path.






    With Tornado would you happen to know how to kill the Python interpreter? A CNTRL-C doesn't do anything.




    I use Linux and Ctrl-C works fine for me. On Windows you can try Ctrl-D or Ctrl-Z. Or here are some answers: Stopping python using ctrl+c






    share|improve this answer




























      0














      Solution: Run your file without the -m argument.



      Another solution would be to provide the file name without the .py extension:



      python -m test


      This will also work.





      Explanation:



      The -m argument tells Python to run a module (file) present in the Python path. It doesn't take the name of the file, it takes the name of the module. The difference is that the file name contains .py suffix, whereas the module name doesn't.



      So you can run the test.py file like this, too: python -m test.





      When to use -m argument:



      The -m argument is there for convenience. For example, if you want to run python's default http server (which comes with python), you'd write this command:



      python -m http.server


      This will start the http server for you. The convenience that -m argument gives you is that you can write this command from anywhere in your system and python will automatically look for the package called http in your the system's Path.



      Without the -m argument, if you wanted to run the http server, you'd have to give it's full path like:



      python C:pathtopythoninstallationhttpserver.py


      So, -m argument makes it easy to run modules (files) present in the Path.






      With Tornado would you happen to know how to kill the Python interpreter? A CNTRL-C doesn't do anything.




      I use Linux and Ctrl-C works fine for me. On Windows you can try Ctrl-D or Ctrl-Z. Or here are some answers: Stopping python using ctrl+c






      share|improve this answer


























        0












        0








        0







        Solution: Run your file without the -m argument.



        Another solution would be to provide the file name without the .py extension:



        python -m test


        This will also work.





        Explanation:



        The -m argument tells Python to run a module (file) present in the Python path. It doesn't take the name of the file, it takes the name of the module. The difference is that the file name contains .py suffix, whereas the module name doesn't.



        So you can run the test.py file like this, too: python -m test.





        When to use -m argument:



        The -m argument is there for convenience. For example, if you want to run python's default http server (which comes with python), you'd write this command:



        python -m http.server


        This will start the http server for you. The convenience that -m argument gives you is that you can write this command from anywhere in your system and python will automatically look for the package called http in your the system's Path.



        Without the -m argument, if you wanted to run the http server, you'd have to give it's full path like:



        python C:pathtopythoninstallationhttpserver.py


        So, -m argument makes it easy to run modules (files) present in the Path.






        With Tornado would you happen to know how to kill the Python interpreter? A CNTRL-C doesn't do anything.




        I use Linux and Ctrl-C works fine for me. On Windows you can try Ctrl-D or Ctrl-Z. Or here are some answers: Stopping python using ctrl+c






        share|improve this answer













        Solution: Run your file without the -m argument.



        Another solution would be to provide the file name without the .py extension:



        python -m test


        This will also work.





        Explanation:



        The -m argument tells Python to run a module (file) present in the Python path. It doesn't take the name of the file, it takes the name of the module. The difference is that the file name contains .py suffix, whereas the module name doesn't.



        So you can run the test.py file like this, too: python -m test.





        When to use -m argument:



        The -m argument is there for convenience. For example, if you want to run python's default http server (which comes with python), you'd write this command:



        python -m http.server


        This will start the http server for you. The convenience that -m argument gives you is that you can write this command from anywhere in your system and python will automatically look for the package called http in your the system's Path.



        Without the -m argument, if you wanted to run the http server, you'd have to give it's full path like:



        python C:pathtopythoninstallationhttpserver.py


        So, -m argument makes it easy to run modules (files) present in the Path.






        With Tornado would you happen to know how to kill the Python interpreter? A CNTRL-C doesn't do anything.




        I use Linux and Ctrl-C works fine for me. On Windows you can try Ctrl-D or Ctrl-Z. Or here are some answers: Stopping python using ctrl+c







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 4 at 20:13









        xyresxyres

        10.1k32446




        10.1k32446
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030519%2fpython-tornado-attributeerror-module-test-has-no-attribute-path%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Angular Downloading a file using contenturl with Basic Authentication

            Monofisismo

            Olmecas