Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A bash script that is a hack to enable very easy Python Imports
Python projects that have complex codebase directory structures introduce a fairly common problem with imports within the project. While providing absolute paths is recommended, it is cumbersome, repetitive, and rather boilerplate. Absolute imports may also decrease application portability. mitigates these issues by simply providing a flattened execution environment, allowing all files to relatively import each other trivially, while allowing developers to maintain their choice of directory structure.

Note: This is just a hack to make things easy while importing. Use at own will.

I do hope people will like this since it does make importing files easy as well as running files from other directories as well.

It is completely open source and can be found at:

Feel free to check it out and leave behind a star if you like it !
Could you give some examples of the code you think is bad and the code you can write instead?
You don't need bash for that.

If you want to import foo you can scan for and add its full path to the PYTHONPATH.
All this can be done in try/except block.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  My First Python Script. Feedback Sought. malonn 5 516 Jun-29-2018, 03:49 PM
Last Post: Zombie_Programming
  SeePy and Loge - easy and fast dynamic report generation with Python lucke 0 598 Dec-16-2017, 11:00 PM
Last Post: lucke
  bash to python: Skaperen 0 857 Apr-08-2017, 07:27 AM
Last Post: Skaperen
  script to filter python files Skaperen 3 1,300 Nov-03-2016, 02:41 AM
Last Post: Skaperen

Forum Jump:

Users browsing this thread: 1 Guest(s)