Git Product home page Git Product logo

Comments (14)

wj-Mcat avatar wj-Mcat commented on May 24, 2024 1

This is the basic python path problem, which is depended on the evironment you use. When you use pycharm as your development IDE, it will set the project root directory into your python path list where the python program will search package at. In your case, when you clone the project into 机器人 directory, the python program will not find the src module which is the problem you are facing.

So, there are some solutions:

  • open the python-wechaty-puppet-itchat-main directory with pycharm, so it will find the src module.
  • add the 机器人/python-wechaty-puppet-itchat-main directory into you sys.path.

Hope that can help you fix the problem.

from python-wechaty-puppet-itchat.

lyleshaw avatar lyleshaw commented on May 24, 2024 1

A ha ~~~, you can contribute changes in this pr, because we have some discussions in this issue which is related to that pr. How do you think about @lyleshaw ?

That's sounds great.

from python-wechaty-puppet-itchat.

zepengliu avatar zepengliu commented on May 24, 2024 1

anotherimport question

first of all, through the method is success without the wrong to import src :Setting -> Project Structure -> Sources however,there is another wrong import .

from python-wechaty-puppet-itchat.

zepengliu avatar zepengliu commented on May 24, 2024 1

the correct result

sorry,it is my problem. i should update sqlalchemy from 1.3.22 to 1.4.25 , it is ok now. I recommend you should write the sqlalchemy version in the requirement.txt also.

from python-wechaty-puppet-itchat.

zepengliu avatar zepengliu commented on May 24, 2024

wrong way to import

it show there is a wrong way to import itchat.

the code can't import from the src.

please check it out

from python-wechaty-puppet-itchat.

wj-Mcat avatar wj-Mcat commented on May 24, 2024

@lyleshaw I think we shoule not rename itchat, which is the source project name, to itchat_wechaty. There are some problems that itchat lies under src directory.

  • when you publish the wechaty-puppet-itchat package, it will package itchat and wechaty-puppet-itchat modules into one package. So, when we install the wechaty-puppet-itchat package, it will install itchat and wechaty_puppet_itchat modules into your site-packages. And what's more, it will exist itchat package before you install it, so it will get into conflict.
  • itchat shoule not be the external pacakge, because it has been heavily modified. In this situation, I suggest that we can move src/itchat directory into src/wechaty_puppet_itchat/ directory. So it will be the sub module of wechaty_puppet_itchat .

we should not import wechaty_puppet_itchat from src package, which is included in published pacakge. You can get publishing detail in setup.py.

from python-wechaty-puppet-itchat.

wj-Mcat avatar wj-Mcat commented on May 24, 2024

@zepengliu for your prblem, I think you can set the python-wechaty-puppet-itchat-main as the sources in your pycharm: Setting -> Project Structure -> Sources. Following this setting, the program will automaticly add it into your sys.path.

This is the small trick and tool of pycharm. Hope that can help you fix this issue.

from python-wechaty-puppet-itchat.

lyleshaw avatar lyleshaw commented on May 24, 2024

@lyleshaw I think we shoule not rename itchat, which is the source project name, to itchat_wechaty. There are some problems that itchat lies under src directory.

  • when you publish the wechaty-puppet-itchat package, it will package itchat and wechaty-puppet-itchat modules into one package. So, when we install the wechaty-puppet-itchat package, it will install itchat and wechaty_puppet_itchat modules into your site-packages. And what's more, it will exist itchat package before you install it, so it will get into conflict.
  • itchat shoule not be the external pacakge, because it has been heavily modified. In this situation, I suggest that we can move src/itchat directory into src/wechaty_puppet_itchat/ directory. So it will be the sub module of wechaty_puppet_itchat .

we should not import wechaty_puppet_itchat from src package, which is included in published pacakge. You can get publishing detail in setup.py.

Got it, I'll close that PR.

from python-wechaty-puppet-itchat.

wj-Mcat avatar wj-Mcat commented on May 24, 2024

A ha ~~~, you can contribute changes in this pr, because we have some discussions in this issue which is related to that pr. How do you think about @lyleshaw ?

from python-wechaty-puppet-itchat.

fangjiyuan avatar fangjiyuan commented on May 24, 2024
anotherimport question

first of all, through the method is success without the wrong to import src :Setting -> Project Structure -> Sources however,there is another wrong import .
同样的问题,ding可以收到,但是不回复dong。

from python-wechaty-puppet-itchat.

zepengliu avatar zepengliu commented on May 24, 2024

wrong import

actually.you can see there is no site-pakage in the file of sqlalchemy.ext like asyncio.please check the code again..

from python-wechaty-puppet-itchat.

lyleshaw avatar lyleshaw commented on May 24, 2024
the correct result

sorry,it is my problem. i should update sqlalchemy from 1.3.22 to 1.4.25 , it is ok now. I recommend you should write the sqlalchemy version in the requirement.txt also.

Got it.

I'll update requirement.txt in the next PR.

Thanks for your suggestion~

from python-wechaty-puppet-itchat.

fangjiyuan avatar fangjiyuan commented on May 24, 2024

因为pycharm和vscode等IDE工具的文件目录机制不同,
为了对入门用户更加友好,建议添加本文件夹路径和src路径。

import sys,os
sys.path.append(os.getcwd()+"/src")
sys.path.append(os.getcwd())

from python-wechaty-puppet-itchat.

wj-Mcat avatar wj-Mcat commented on May 24, 2024

因为pycharm和vscode等IDE工具的文件目录机制不同, 为了对入门用户更加友好,建议添加本文件夹路径和src路径。

import sys,os sys.path.append(os.getcwd()+"/src") sys.path.append(os.getcwd())

Thanks for your solution for this problem. But this is the very simple python path issue for developer which should not be here.

What's more, If you use the python-wechaty-puppet-itchat package, you will pip install wechaty-puppet-itchat not
other than cloning the source code. So we should not add the src dir to python path variable list.

How do you think about it ? @fangjiyuan

from python-wechaty-puppet-itchat.

Related Issues (16)

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.