Python Forum
problem with importing my program
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with importing my program
Just trying to have a go with python debugger

From the python cmd line

 >>> import pdb 
so far so good...

>>> import C:\users\me\documents\my_python\ 
gives a syntax error " invalid syntax " with a  pointer to the :
tried a few variations, but no, python really doesn't like file addresses, just spits them all out with roughly the same syntax error.
You can't import a path, instead you should make sure that your script is somewhere Python knows to find it. It's also a pitfall to name your script the name of an existing module; you can check for this by opening a Python shell and trying to import it before you've created it (e.g. in this case import test, which will work). Your version can "shadow" the built-in version, and if something else relied on it, that thing will be broken.

So: rename your file to something unique, and make sure your path is all good, and things should work as expected.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with importing python-telegram library into the project gandonio 1 213 Nov-01-2022, 02:19 AM
Last Post: deanhystad
  Problem with importing Python file in Visual Studio Code DXav 7 964 Jun-15-2022, 12:54 PM
Last Post: snippsat
  Importing Program Wide JarredAwesome 4 1,453 Sep-07-2020, 04:34 PM
Last Post: JarredAwesome
  Please help: problem installing/importing langdetect module in Jupyter Notebook ledgreve 3 5,412 Dec-30-2019, 08:17 AM
Last Post: LeanbridgeTech
  Problem with importing and using collections module pythomdummy 3 4,456 Nov-14-2019, 08:48 AM
Last Post: Gribouillis
  Problem with importing a CSV file Chopan2211 6 6,291 Nov-06-2019, 09:25 AM
Last Post: DeaD_EyE
  Problem importing resource library ChrisM 8 2,678 Oct-23-2019, 01:40 PM
Last Post: ChrisM
  Problem: Once I cancel the process my program will start working! Hadad 0 1,200 Jul-24-2019, 04:09 PM
Last Post: Hadad
  Problem with importing an installed package Reverend_Jim 4 2,859 Jun-14-2019, 10:20 PM
Last Post: Reverend_Jim
  Program Problem (2) ChrisG 2 1,718 May-25-2019, 05:11 PM
Last Post: ChrisG

Forum Jump:

User Panel Messages

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