Python Forum
using self-developed modules
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using self-developed modules
#4
Thx for your suggestions.
T
First some more info: some time ago I have installed Python 3.7.4 and all the “packages” that I need using the standard installation (“Install Now” without customizing folder names). I selected the “Install Launcher” and “Add PATH” as recommended.

I have tried, as you suggested, with “solution 3”, but it definitely looks as if my Python does not “follow the book”.
I have documented both modules with some more comments here”)

# main.py
#
# is stored in G:\\UserData\\actname\\Documents\\Programmas\\Python_3-7-4\\
#
import sys
from selfwrittenmodule import f1, f2
def if1(x):
    a = f1(x);return(a)
def if2(x):
    a = f2(x);return(a)

b = 2
a = if1(b)
c = if2(b)
print (a, c)
# selfwrittenmodule.py
#
# is stored in C:\\Users\\actname\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\generaluse\\
#
def f1(x):
    x = x + 1
def f2(x)
    x = x + 10
When I “edit” main with IdleX and press F5 (run), then I receive this error msg:

Error:
Traceback (most recent call last): File "G:\UserData\actname\Documents\Programs\Python_3-7-4\main.py", line 6, in <module> from selfwrittenmodule import f1, f2 ModuleNotFoundError: No module named 'selfwrittenmodule'
Then I renamed the foldername from C:\\Users\\actname\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\generaluse\\ to C:\\Users\\actname\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\selfwrittenmodule\\, and executed “main” again with IdleX. Then I get this error message:
Error:
Traceback (most recent call last): File "G:\UserData\actname\Documents\Programs\Python_3-7-4\main.py", line 6, in <module> from selfwrittenmodule import f1, f2 ImportError: cannot import name 'f1' from 'selfwrittenmodule' (unknown location) >>>
Please tell me what I did wrong.
Reply


Messages In This Thread
using self-developed modules - by wlp - Aug-28-2019, 03:04 PM
RE: using self-developed modules - by wlp - Aug-28-2019, 04:05 PM
RE: using self-developed modules - by snippsat - Aug-28-2019, 05:41 PM
RE: using self-developed modules - by wlp - Aug-29-2019, 10:36 AM
RE: using self-developed modules - by perfringo - Aug-29-2019, 11:22 AM
RE: using self-developed modules - by snippsat - Aug-29-2019, 03:29 PM
RE: using self-developed modules - by wlp - Aug-29-2019, 04:18 PM
RE: using self-developed modules - by snippsat - Aug-29-2019, 05:20 PM
RE: using self-developed modules - by wlp - Aug-30-2019, 02:18 PM
RE: using self-developed modules - by snippsat - Aug-30-2019, 03:17 PM
RE: using self-developed modules - by wlp - Aug-30-2019, 04:16 PM
RE: using self-developed modules - by snippsat - Aug-30-2019, 07:10 PM
RE: using self-developed modules - by wlp - Aug-31-2019, 01:45 PM
RE: using self-developed modules - by snippsat - Aug-31-2019, 05:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Developed App in VS2019 - Help with pyinstaller fioranosnake 0 1,630 Nov-11-2019, 09:12 PM
Last Post: fioranosnake
  Modules issue, pip3 download modules only to pyhton3.5.2 not the latest 3.6.1 bmohanraj91 6 8,521 May-25-2017, 08:15 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020