Giter Club home page Giter Club logo

Comments (5)

mlouielu avatar mlouielu commented on May 23, 2024

Hi @HANK538,

You should not install "analytics", which is not used by twstock, twstock is using its analytics module (twstock/analytics.py), since you install analytics package (pip install analytics), it caused python to find another package.

You can remove the analytics package by $ pip uninstall analytics, it should solved this issue.

Anyway, it is encouraged to use $ python -m pip ... to execute pip, since using pip alone you will not sure which python interpreter is been used for the pip.

from twstock.

HANK538 avatar HANK538 commented on May 23, 2024

Hi mlouielu

Thanks for your reply.
But I encountered below issue after uninstalled analytics.

Traceback (most recent call last):
File "d:/Project/A00 Test/stock.py", line 1, in
import twstock
File "C:\Users\10802304\AppData\Roaming\Python\Python37\site-packages\twstock_init_.py", line 3, in
from twstock import stock
File "C:\Users\10802304\AppData\Roaming\Python\Python37\site-packages\twstock\stock.py", line 21, in
from codes import codes
ModuleNotFoundError: No module named 'codes'

Any solution?

from twstock.

mlouielu avatar mlouielu commented on May 23, 2024

Hi @HANK538

I suggest you can open the file "C:\Users\10802304\AppData\Roaming\Python\Python37\site-packages\twstock\stock.py", and find maybe at line 16 have this:

 try:                                                                                                                                                                                                                                       
     from . import analytics                                                                                                                                                                                                                
     from .codes import codes                                                                                                                                                                                                               
 except ImportError:                                                                                                                                                                                                                        
     import analytics                                                                                                                                                                                                                       
     from codes import codes                                                                                                                                                                                                                

Please replace it to this

try:
    from . import analytics
    from .codes import codes
except ImportError as e:
    print('Error: ', e)
    import analytics
    from codes import codes

Check and paste the otuput of what causing this ImportError, thanks

from twstock.

HANK538 avatar HANK538 commented on May 23, 2024

Thank you for the prompt reply!

ModuleNotFoundError: No module named 'lxml'

It works now after installed twstock and lxml package.

By the way, I just followed below blog so that's why I installed analytics package.
http://yhhuang1966.blogspot.com/2019/04/twstock.html

Thanks a lot.

from twstock.

mlouielu avatar mlouielu commented on May 23, 2024

Thanks for your reply, this should consider as a bug that not intent to be (Is because the dependency lxml didn't install, not because import relative package causing an error).

I'll reopen this issue to fix it.

from twstock.

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.