Python Forum
switch from version 3.5.3 to 3.8.6 get import error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
switch from version 3.5.3 to 3.8.6 get import error
#1
I am relatively new to Python. I have two small py programs. It runs on 3.5.3. When I switch to a newer version of Python (version 3.8.6). I got the following error:

File ".\resources\scripts\batchEditProtocolXML.py", line 1, in <module>
import replaceLineInFiles
ModuleNotFoundError: No module named 'replaceLineInFiles'


after some research, I changed the import statement. Then I got the following error:

File ".\resources\scripts\batchEditProtocolXML.py", line 1, in <module>
from .replaceLineInFiles import replace
ImportError: attempted relative import with no known parent package


I know there are some big differences between Python 2 and 3. But I am surprised that the differences between 3.5 and 3.8 are not small. Does this mean I have to create a package/module on each file/unit/groupOfFunctions? Anywhere (books, online sites) I can find the information about the differences between major release versions?
Reply


Messages In This Thread
switch from version 3.5.3 to 3.8.6 get import error - by python001 - Oct-30-2020, 05:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error on import: SyntaxError: source code string cannot contain null bytes kirkwilliams2049 7 6,166 Aug-03-2023, 06:00 PM
Last Post: Gribouillis
  import module error tantony 5 3,360 Dec-15-2022, 01:55 PM
Last Post: Lauraburmrs
  Cryptic Error with import statement Led_Zeppelin 2 2,478 Jan-11-2022, 01:13 PM
Last Post: Led_Zeppelin
  Install any library via pip get an error cannot import name 'SCHEME_KEYS' from 'pip. Anldra12 2 10,490 Jan-04-2022, 01:05 PM
Last Post: Anldra12
  best way to use switch case? korenron 8 2,930 Aug-18-2021, 03:16 PM
Last Post: naughtyCat
  import module with syntax error Skaperen 7 5,160 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Import Error Christian 3 3,131 Apr-17-2021, 11:27 PM
Last Post: bowlofred
  Error on Python Version? ErnestTBass 6 3,421 Dec-09-2020, 04:02 PM
Last Post: ErnestTBass
  Folium import error kashif_flavio 2 3,568 Dec-07-2020, 08:58 AM
Last Post: bowlofred
  Import error Beingcode 0 2,467 Nov-20-2020, 02:57 AM
Last Post: Beingcode

Forum Jump:

User Panel Messages

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