0
import config as regex

    except Exception as e:
    logging.error('Issue in Calcutaing: '+str(e))
    return None

I want to execute this program but it gives the following error.

    import config as regex
  File "/usr/local/lib/python3.5/dist-packages/config.py", line 733
    except Exception, e:
                ^
Jay Pratap Pandey
  • 352
  • 2
  • 9
  • 19

1 Answers1

0

In Python 3 the line

except Exception, e:

must be written as

except Exception as e:

Likely, if you want your module to be published, you should also give it a more descriptive name than config.

phihag
  • 278,196
  • 72
  • 453
  • 469
  • I am already using except Exception as e:, How I give more descriptive name? – Jay Pratap Pandey Jan 02 '18 at 07:23
  • Are you sure? Your error message says otherwise. If you want to install a package, either move and install it to a subdirectory (so it ends up getting installed as `/usr/local/lib/python3.5/dist-packages/myproject/config.py`), or, if it should be a top-level module, rename it to a unique name (`jaysconfig.py`). – phihag Jan 02 '18 at 07:34
  • Yes, I already install it, there is no any myproject directory, if i build it then it shows access denied. – Jay Pratap Pandey Jan 02 '18 at 15:10