python

  • ImportError: attempted relative import with no known parent package

    You are trying to use relative imports in python but you get you encounter the `ImportError: attempted relative import with no known parent package` exception. Why the python interpreter complains ? What did you do wrong ? read more
    ImportError: attempted relative import with no known parent package
  • Download Files with zagoload

    The `zagoload` allows to access local files and remote files – files which are accessible thought HTTP and FTP protocols – in uniform way. The files can be cached locally. read more
    Download Files with zagoload
  • Restrict the creation of objects in python

    While c++ and Java has authorization system for accessing class entities such as methods and member variables, Python does not have one. In this article, we will see how we can create an authorization system to avoid accidents. read more
    Restrict the creation of objects in python
  • Changing the process name of python script in windows

    You have created several python scripts and running them simultaneously. You decide you want to kill first script you run. As always, you open `Windows Task Manager` but then you see several `python.exe` processes. Which one is the script you want to kill? You do not have clue. If you you recognize this situation – The following script I wrote allows to overcome this issue and change name of python processes to unique one. read more
    Changing the process name of python script in windows
  • Download Files with fileloader

    The `fileloader` allows to access local files and remote files – files which are accessible thought HTTP and FTP protocols – in uniform way. The files can be cached locally. read more
    Download Files with fileloader
  • Solution to producer and consumer problem in python

    In my last project, I needed synchronize producer and consumers threads. The producer thread was responsible to generate the tasks while the consumer threads were responsible to execute them. This classic producer and consumer problem can be easily solved using the Queue module. read more
    Solution to producer and consumer problem in python
  • Log exception in python

    When exceptions happens, you may find it useful to log the exception and its stack trace for further investigation. In this article, you will learn how to retrieve the current exception and its properties – its type and its stack trace. read more
    Log exception in python
  • Mimic reference parameters in python

    In my recent project, I needed to migrate c# code which uses reference parameters. Unfortunately, python does not support reference parameters - In this article we will see how can we mimic their semantics in python. read more
    Mimic reference parameters in python