create account

[Tutorial] Packaging and deploying(Part 3) by yalzeee

View this thread on: hive.blogpeakd.comecency.com
· @yalzeee ·
$12.74
[Tutorial] Packaging and deploying(Part 3)
![images.png](https://cdn.steemitimages.com/DQmYqni9vxME8D1tzy4wZGgu8CT8zK2Goq5cwDaQia7Zg7J/images.png)
[image source](https://goo.gl/images/HbqzGY)
**Repository**: [Python, Open Source Repository](https://github.com/python)

**Software**: For software download python 3.0 compatible with your OS [here](https://www.python.org/downloads/)

**Difficulty** : Basic
**What you will learn**:
In this tutorial you will learn how to
-  Using the ``pyinstaller``
 
- How to change our file to ``.exe``  system readable format.

- Enable our program to run on startup

**For my previous posts in the python tutorial series**
-[Click Here* Creating a simple calculator using python 3.8(cpython)](https://steemit.com/utopian-io/@yalzeee/tutorial-developing-a-simple-calculator-with-basic-command-with-python-fix-bugs-in-your-code)

**Creating an encryption key(Cryptography)**
-[ Part 1](https://steemit.com/utopian-io/@yalzeee/tutorial-creating-a-visual-cube-encryption-key-using-python-3-0-part-1)
-[ Part 2](https://steemit.com/utopian-io/@yalzeee/tutorial-creating-a-visual-encryption-key-in-python-3-6-part-2)
-[ Part 3](https://steemit.com/utopian-io/@yalzeee/tutorial-creating-an-visual-cube-encryption-program-with-python-3-6-part-3)
-[ Part 4](https://steemit.com/utopian-io/@yalzeee/tutorial-creating-an-encryption-program-with-python-3-6-part-4)

**Developing an institutions data collection backend and frontend with python 3.6 series**
[Part 1 of this series](https://steemit.com/utopian-io/@yalzeee/tutorial-development-of-an-institutions-data-collection-backend-using-python-3-6-part-1)
[Part 2 of this series](https://steemit.com/utopian-io/@yalzeee/tutorial-development-of-an-institutions-data-collection-back-end-using-python-3-6-part-2)
[Part 3 of this series](https://steemit.com/utopian-io/@yalzeee/tutorial-development-of-an-institutions-data-collection-back-end-with-python-3-part-3)
[Part 4 of this series](https://steemit.com/utopian-io/@yalzeee/tutorial-developing-an-institutions-data-collection-web-front-end-with-python-3-6-part-4)
[Part 5 of this series](https://steemit.com/utopian-io/@yalzeee/tutorial-developing-an-institutions-data-collection-web-front-end-with-python-3-6-part-5)
[Part 6 of this series](https://steemit.com/utopian-io/@yalzeee/tutorial-developing-and-institutions-data-collection-web-front-end-and-back-end-with-python3-6-final-part6)

**Earlier on this series**
[Automating OnScreen Processes](https://steemit.com/utopian-io/@yalzeee/tutorial-navigation-and-system-interaction-automating-system-processes-in-python-development)
[Screen Mapping and Navigation](https://steemit.com/utopian-io/@yalzeee/tutorial-image-recognition-and-screen-mapping-in-python-developments-part-2)

**Tutorial**
In the last of this series we developed a steemit feed bot that can locate your browser, load your steemit feed and explore this feed for you. Although our code works perfectly we havent yet created a user interface and our code is still in py format which cannot be executed outside our python editor. This tutorial would be covering that. 
First things first we need to install a new module within our ``cmd`` console.

**Modules**
Navigate to your python folder and run these lines of code to install ``pyinstaller``;
```
pip install pyinstaller
```
**Note**
``pip`` is already installed in all versions of python from >3.4

**Py Installer**
Py installer is a packaging file that would help us change our program to a exe which is the normal readable format for windows files. After we install this module, we have to find a suitable icon for our program. 
**Note**: This icon must be in ``.ico`` format to be able to be read and should be in the same folder with our python code.
![Screenshot (21).png](https://cdn.steemitimages.com/DQmS4qufSCZuLzqsEAJLi2rzWTyyDJNHtLEj5GYE5KstgZK/Screenshot%20(21).png)
Use ``shift + right click`` to open your command prompt module within this folder
```
#Use this code to compile your file to exe in your command prompt module
pyinstaller -w -F  "my steemit feed bot"
```
To add the icon use while in the same directory
```
pyinstaller -i "my steemit feed bot"
```
**Deploying**
The next thing we have to do is to deploy our application whenever we start up our system.
To do this create a shortcut for our ``exe`` executable file then navigate to your local disk and look for this directory which is available by default in windows.
The file path should be
```
C:/ ProgramData/Microsoft/Windows/StartMenu/Programs
```
Navigate to this folder and place the shortcut at this location for it to startup whenever the system comes on.

**Common Bugs and Fixes**
A common bug in systems with smaller RAMs or slower processors is that the desktop may not have fully loaded when your program begins to run and hence because it works with image recognition would not log the coordinates of your browser. To fix this 
```
import pyautogui
import time    

time.sleep(120)
def openchrome():
    chromeIcon = pyautogui.locateCenterOnScreen('C:/Users/ZEOY/Pictures/Screenshots/python/chromeIcon.png')
    print(chromeIcon)
    pyautogui.doubleClick(chromeIcon)
    time.sleep(3.0)
def maximizetab():
    maximizebutton = pyautogui.locateCenterOnScreen('C:/Users/ZEOY/Pictures/Screenshots/python/maximize.png')
    print(maximizebutton)
    pyautogui.click(maximizebutton)
    time.sleep(4)
```
Simply use the sleep function to make the program give the system time to boot.

**Please feel free to share any other bot encountered when trying to run this program on your system**

You can find my Code in [Github](https://github.com/yalzeee/Python-tutorial-series/blob/master/my%20steemit%20feed%20bot)
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 28 others
properties (23)
authoryalzeee
permlinktutorial-packaging-and-deploying-part-3
categoryutopian-io
json_metadata{"tags":["utopian-io","tutorials","programming","stach","wafrica"],"image":["https://cdn.steemitimages.com/DQmYqni9vxME8D1tzy4wZGgu8CT8zK2Goq5cwDaQia7Zg7J/images.png","https://cdn.steemitimages.com/DQmS4qufSCZuLzqsEAJLi2rzWTyyDJNHtLEj5GYE5KstgZK/Screenshot%20(21).png"],"links":["https://goo.gl/images/HbqzGY","https://github.com/python","https://www.python.org/downloads/","https://steemit.com/utopian-io/@yalzeee/tutorial-developing-a-simple-calculator-with-basic-command-with-python-fix-bugs-in-your-code","https://steemit.com/utopian-io/@yalzeee/tutorial-creating-a-visual-cube-encryption-key-using-python-3-0-part-1","https://steemit.com/utopian-io/@yalzeee/tutorial-creating-a-visual-encryption-key-in-python-3-6-part-2","https://steemit.com/utopian-io/@yalzeee/tutorial-creating-an-visual-cube-encryption-program-with-python-3-6-part-3","https://steemit.com/utopian-io/@yalzeee/tutorial-creating-an-encryption-program-with-python-3-6-part-4","https://steemit.com/utopian-io/@yalzeee/tutorial-development-of-an-institutions-data-collection-backend-using-python-3-6-part-1","https://steemit.com/utopian-io/@yalzeee/tutorial-development-of-an-institutions-data-collection-back-end-using-python-3-6-part-2","https://steemit.com/utopian-io/@yalzeee/tutorial-development-of-an-institutions-data-collection-back-end-with-python-3-part-3","https://steemit.com/utopian-io/@yalzeee/tutorial-developing-an-institutions-data-collection-web-front-end-with-python-3-6-part-4","https://steemit.com/utopian-io/@yalzeee/tutorial-developing-an-institutions-data-collection-web-front-end-with-python-3-6-part-5","https://steemit.com/utopian-io/@yalzeee/tutorial-developing-and-institutions-data-collection-web-front-end-and-back-end-with-python3-6-final-part6","https://steemit.com/utopian-io/@yalzeee/tutorial-navigation-and-system-interaction-automating-system-processes-in-python-development","https://steemit.com/utopian-io/@yalzeee/tutorial-image-recognition-and-screen-mapping-in-python-developments-part-2","https://github.com/yalzeee/Python-tutorial-series/blob/master/my%20steemit%20feed%20bot"],"app":"steemit/0.1","format":"markdown"}
created2018-08-16 18:34:45
last_update2018-08-16 18:34:45
depth0
children7
last_payout2018-08-23 18:34:45
cashout_time1969-12-31 23:59:59
total_payout_value9.705 HBD
curator_payout_value3.031 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,662
author_reputation12,484,565,044,191
root_title"[Tutorial] Packaging and deploying(Part 3)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,417,759
net_rshares9,772,139,630,639
author_curate_reward""
vote details (92)
@kenechukwu2 ·
Thank you for this code as short as it was, I was able to run it without any problem.
πŸ‘  
properties (23)
authorkenechukwu2
permlinkre-yalzeee-tutorial-packaging-and-deploying-part-3-20180816t184141496z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-08-16 18:41:42
last_update2018-08-16 18:41:42
depth1
children1
last_payout2018-08-23 18:41:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length85
author_reputation1,373,218,176,262
root_title"[Tutorial] Packaging and deploying(Part 3)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,418,304
net_rshares4,286,998,311
author_curate_reward""
vote details (1)
@yalzeee ·
I'm glad it was helpful
I had to make a post to end the series by explaining how to deploy on startup and it is brief and  isn't too complicated but is totally necessaary . Glad it worked for you.
properties (22)
authoryalzeee
permlinkre-kenechukwu2-re-yalzeee-tutorial-packaging-and-deploying-part-3-20180816t191116574z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-08-16 19:11:21
last_update2018-08-16 19:11:21
depth2
children0
last_payout2018-08-23 19:11:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length196
author_reputation12,484,565,044,191
root_title"[Tutorial] Packaging and deploying(Part 3)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,420,664
net_rshares0
@portugalcoin ·
$7.99
Thank you for your contribution.

- Improve the structure of your tutorial. <a href="https://guides.github.com/features/mastering-markdown/">Markdown</a>


Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/8/33313334).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , ,
properties (23)
authorportugalcoin
permlinkre-yalzeee-tutorial-packaging-and-deploying-part-3-20180816t203819369z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://guides.github.com/features/mastering-markdown/","https://join.utopian.io/guidelines","https://review.utopian.io/result/8/33313334","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2018-08-16 20:38:18
last_update2018-08-16 20:38:18
depth1
children1
last_payout2018-08-23 20:38:18
cashout_time1969-12-31 23:59:59
total_payout_value6.025 HBD
curator_payout_value1.962 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length646
author_reputation598,935,713,442,594
root_title"[Tutorial] Packaging and deploying(Part 3)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,426,673
net_rshares6,138,570,800,437
author_curate_reward""
vote details (7)
@utopian-io ·
$0.02
Thank you for your review, @portugalcoin!

So far this week you've reviewed 24 contributions. Keep up the good work!
πŸ‘  ,
properties (23)
authorutopian-io
permlinkre-re-yalzeee-tutorial-packaging-and-deploying-part-3-20180816t203819369z-20180818t221008z
categoryutopian-io
json_metadata"{"app": "beem/0.19.42"}"
created2018-08-18 22:10:09
last_update2018-08-18 22:10:09
depth2
children0
last_payout2018-08-25 22:10:09
cashout_time1969-12-31 23:59:59
total_payout_value0.019 HBD
curator_payout_value0.004 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length116
author_reputation152,955,367,999,756
root_title"[Tutorial] Packaging and deploying(Part 3)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,640,566
net_rshares18,067,020,297
author_curate_reward""
vote details (2)
@steem-ua ·
Hi @yalzeee! We are @steem-ua, a new Steem dApp, computing UserAuthority for all accounts on Steem. We are currently in test modus upvoting quality Utopian-io contributions! Nice work!
πŸ‘  
properties (23)
authorsteem-ua
permlinkre-tutorial-packaging-and-deploying-part-3-20180816t205826z
categoryutopian-io
json_metadata"{"app": "beem/0.19.54"}"
created2018-08-16 20:58:24
last_update2018-08-16 20:58:24
depth1
children0
last_payout2018-08-23 20:58:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length184
author_reputation23,214,230,978,060
root_title"[Tutorial] Packaging and deploying(Part 3)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,428,040
net_rshares4,353,635,591
author_curate_reward""
vote details (1)
@steemitboard ·
Congratulations @yalzeee! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/votes.png)](http://steemitboard.com/@yalzeee) Award for the number of upvotes

<sub>_Click on the badge to view your Board of Honor._</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Do not miss the last post from @steemitboard:**
[SteemitBoard and the Veterans on Steemit - The First Community Badge.](https://steemit.com/veterans/@steemitboard/steemitboard-and-the-veterans-on-steemit-the-first-community-badge)

> Do you like [SteemitBoard's project](https://steemit.com/@steemitboard)? Then **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-yalzeee-20180822t164921000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-08-22 16:49:21
last_update2018-08-22 16:49:21
depth1
children0
last_payout2018-08-29 16:49:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length902
author_reputation38,975,615,169,260
root_title"[Tutorial] Packaging and deploying(Part 3)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id69,036,047
net_rshares0
@utopian-io ·
$0.02
Hey @yalzeee
 **Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
πŸ‘  ,
properties (23)
authorutopian-io
permlinkre-tutorial-packaging-and-deploying-part-3-20180819t084532z
categoryutopian-io
json_metadata"{"app": "beem/0.19.42"}"
created2018-08-19 08:45:33
last_update2018-08-19 08:45:33
depth1
children0
last_payout2018-08-26 08:45:33
cashout_time1969-12-31 23:59:59
total_payout_value0.019 HBD
curator_payout_value0.004 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length300
author_reputation152,955,367,999,756
root_title"[Tutorial] Packaging and deploying(Part 3)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,678,111
net_rshares18,070,046,292
author_curate_reward""
vote details (2)