Skip to main content
clarified problem description: error is on calling the code, not just importing it
Source Link
Ethan Furman
  • 70.1k
  • 21
  • 173
  • 251

iI have a module blah.time where iI do some sanity checks and wrapper functions around normal time and date operations:

import time

def sleep(n):
    time.sleep(n)

when i use this codeWhen I call sleep, it just throws a maximum recursion error. i'mI'm guessing the namespace is wrong, so iI tried using import time as _time, but iI still get the same error.

howHow do iI reference the system time module from within my own module in order to prevent this namespace conflict?

i have a module blah.time where i do some sanity checks and wrapper functions around normal time and date operations:

import time

def sleep(n):
    time.sleep(n)

when i use this code, it just throws a maximum recursion error. i'm guessing the namespace wrong, so i tried using import time as _time, but i still get the same error.

how do i reference the system time module from within my own module in order to prevent this namespace conflict?

I have a module blah.time where I do some sanity checks and wrapper functions around normal time and date operations:

import time

def sleep(n):
    time.sleep(n)

When I call sleep, it just throws a maximum recursion error. I'm guessing the namespace is wrong, so I tried using import time as _time, but I still get the same error.

How do I reference the system time module from within my own module in order to prevent this namespace conflict?

Source Link
yee379
  • 6.8k
  • 11
  • 63
  • 107

import python package when module is same name

i have a module blah.time where i do some sanity checks and wrapper functions around normal time and date operations:

import time

def sleep(n):
    time.sleep(n)

when i use this code, it just throws a maximum recursion error. i'm guessing the namespace wrong, so i tried using import time as _time, but i still get the same error.

how do i reference the system time module from within my own module in order to prevent this namespace conflict?