Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13921

ModuleNotFoundError: No module named 'kdconnector' in test script after checking things like PYTHONPATH, __init__.py etc

$
0
0

I created the following script to test for ModuleNotFound error I am getting in other scripts.

#kdconnecotsite/facebookapi/methods/testing.pyfrom kdconnector.models import Master, ClientAccounts, Client, Campaigns, Adsdef Execute(access_token, app_secret, ad_id):    return "test completed"# Example usageif __name__ == '__main__':    print('example usage test')    access_token = 'EAAUIU8EilCcBABhtG7ZAQKUPMuZBo8NWOUwhBhma5MaKS2VI3s0U8W3aARwkbqKoxe0zyo4Vsdc7MStyEvyRoWvptiDICaiFTSaU5ZAlANea2nziOHuNxyNaBn9w1O3y0ZCZCk03dpd2NeBr7q6qmOixYCaHYMaEuZCn7ZCO1llBKYYHGPGtA6TVOucsPWZBLHcZD'    ad_id = '23853970342650529'    app_secret = '123456789'    result = Execute(access_token, app_secret, ad_id)    print('result = %s', result)

the PYTHONPATH includes the kdconnectorsite folder above the testing.py script as well as the kdconnector folder. On creating the script, vscode finds kdconnector, models, and all the models as I type in the script.

Running the script in vscode yields, File "c:\Users\MikeOliver\KDConnectorSite\kdconnectorsite\facebookapi\methods\testing.py", line 3, in <module> from kdconnector.models import Master, ClientAccounts, Client, Campaigns, Ads ModuleNotFoundError: No module named 'kdconnector'

Running check does not complain.(venv) PS C:\Users\MikeOliver\KDConnectorSite\kdconnectorsite> python manage.py checkkdconnectorsite.__init__opened logging.yaml2024-01-20 10:46:38,394 - kdconnectorsite - INFO - Configured the logger!2024-01-20 10:46:38,897 - kdconnector.models - INFO - Now logging in models2024-01-20 10:46:38,897 - kdconnector.models - INFO - Now logging in models2024-01-20 10:46:38,919 - kdconnector.admin - INFO - Now logging in admin2024-01-20 10:46:38,919 - kdconnector.admin - INFO - Now logging in admin2024-01-20 10:46:39,217 - kdconnector.fbugenerator - INFO - Now logging in FBUGenerator2024-01-20 10:46:39,217 - kdconnector.fbugenerator - INFO - Now logging in FBUGenerator2024-01-20 10:46:39,218 - kdconnector.valuegenerator - INFO - Now logging in valuegenerator2024-01-20 10:46:39,218 - kdconnector.valuegenerator - INFO - Now logging in valuegenerator2024-01-20 10:46:39,219 - facebookapi.fetchMetadata - INFO - Now logging in views2024-01-20 10:46:39,219 - facebookapi.fetchMetadata - INFO - Now logging in views2024-01-20 10:46:39,237 - facebookapi.fetchInsights - INFO - Now logging in views2024-01-20 10:46:39,237 - facebookapi.fetchInsights - INFO - Now logging in views2024-01-20 10:46:39,240 - facebookapi.fetchCampaign - INFO - Now logging in views2024-01-20 10:46:39,240 - facebookapi.fetchCampaign - INFO - Now logging in views2024-01-20 10:46:39,242 - kdconnector.serializers.clientserializer - INFO - Now logging in ClientSerializer2024-01-20 10:46:39,242 - kdconnector.serializers.clientserializer - INFO - Now logging in ClientSerializer2024-01-20 10:46:39,244 - kdconnector.views - INFO - Now logging in views2024-01-20 10:46:39,244 - kdconnector.views - INFO - Now logging in viewsSystem check identified no issues (0 silenced).

I have looked through similar posts on stack overflow and checked all the points I found that applied, and nothing works. I even thought abouet creating anew repo and building module by module to check the structure, but it was all the same.

I even tried ChatGPT with this testing.py and checked all its suggestions.

What do I try next, or more likely, some minute detail I missed?

Mike Oliver

Here is the structure for C:\Users\MikeOliver\KDConnectorSite\

Folder Structure Showing location of testing.py

PYTHONPATH

C:\Users\MikeOliver\KDConnectorSite\


Viewing all articles
Browse latest Browse all 13921

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>