<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Eshleron</title>
    <description>The latest articles on Forem by Eshleron (@eshleron).</description>
    <link>https://forem.com/eshleron</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F129349%2F3eabad66-c23a-4d4c-951a-34bc0eaa8b10.jpeg</url>
      <title>Forem: Eshleron</title>
      <link>https://forem.com/eshleron</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/eshleron"/>
    <language>en</language>
    <item>
      <title>How to convert .py to .exe? Step by step guide.</title>
      <dc:creator>Eshleron</dc:creator>
      <pubDate>Thu, 24 Jan 2019 11:54:53 +0000</pubDate>
      <link>https://forem.com/eshleron/how-to-convert-py-to-exe-step-by-step-guide-3cfi</link>
      <guid>https://forem.com/eshleron/how-to-convert-py-to-exe-step-by-step-guide-3cfi</guid>
      <description>&lt;h1&gt;
  
  
  Auto PY to EXE
&lt;/h1&gt;

&lt;p&gt;The only tool that we are gonna be using is &lt;strong&gt;Auto PY to EXE&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auto PY to EXE&lt;/strong&gt; is an amazing application for making .exe file out of your project whether it is one .py file or any number of them.&lt;br&gt;
The application has a nice gui and looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwarehouse-camo.cmh1.psfhosted.org%2F4fc81b16448c94eda8a266110b56284ca9883185%2F68747470733a2f2f692e696d6775722e636f6d2f6464304c43326e2e706e67" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwarehouse-camo.cmh1.psfhosted.org%2F4fc81b16448c94eda8a266110b56284ca9883185%2F68747470733a2f2f692e696d6775722e636f6d2f6464304c43326e2e706e67" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How to start
&lt;/h2&gt;
&lt;h2&gt;
  
  
  Step 1. Installation
&lt;/h2&gt;

&lt;p&gt;Installing using PyPI:&lt;/p&gt;

&lt;p&gt;To install the application run this line in &lt;strong&gt;cmd&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip install auto-py-to-exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To open the application run this line in &lt;strong&gt;cmd&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;auto-py-to-exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note: if you have any problems installing this way or you want to install it from GitHub go to the &lt;a href="https://pypi.org/project/auto-py-to-exe" rel="noopener noreferrer"&gt;main page&lt;/a&gt; or watch this instructional video by the developer of "Auto PY to EXE" &lt;a href="https://github.com/brentvollebregt" rel="noopener noreferrer"&gt;himself&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/OZSZHmWSOeM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  For more additional information use this
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe" rel="noopener noreferrer"&gt;"Issues When Using auto-py-to-exe"&lt;/a&gt;
&lt;/h4&gt;

&lt;h2&gt;
  
  
  Step 2. Converting
&lt;/h2&gt;

&lt;p&gt;There are few main options you need to choose:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pick your .py file&lt;/li&gt;
&lt;li&gt;Pick "One Directory" or "One File" option&lt;/li&gt;
&lt;li&gt;Pick additional files&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Pick your .py file
&lt;/h2&gt;

&lt;p&gt;If you have multiple files choose one that starts the program.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.1. "One Directory" option
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F9mrf0i0cm0shdgoizjdz.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F9mrf0i0cm0shdgoizjdz.JPG" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pretty simple. When choosing "One Directory" option "Auto PY to EXE" will put all dependencies in &lt;strong&gt;one folder&lt;/strong&gt;. You can choose Output directory in "Advanced" menu. If you have media files like icons and backgrounds you shouldn't have any problems using them inside your .exe if you place media files/folders in the Output directory.&lt;br&gt;
Something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1a8b99f7f5gggq7fe7cv.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1a8b99f7f5gggq7fe7cv.JPG" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2.2. "One File" option
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcuq5tm4xsjnngoi6uqmc.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcuq5tm4xsjnngoi6uqmc.JPG" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When choosing "One File" option "Auto PY to EXE" will create &lt;strong&gt;one .exe file&lt;/strong&gt; containing all dependencies but &lt;strong&gt;NOT MEDIA FILES&lt;/strong&gt;. If your program has only &lt;strong&gt;default Windows gui&lt;/strong&gt; with no icons, backgrounds, media files or you are OK with placing media folder near .exe file feel free to skip the following explanation. For those who want to pack media files into .exe file itself read paragraph 3.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Pick additional files
&lt;/h2&gt;

&lt;p&gt;There is a menu in "Auto PY to EXE" called "Additional Files" that lets you add files of your choice. There is a catch though. "Auto PY to EXE" uses &lt;strong&gt;pyinstaller&lt;/strong&gt; which unpacks the data into a temporary folder and stores this directory path in the _MEIPASS environment variable. Your project won't find necessary files because the path changed and it won't see the new path either. In other words, if option "One File" is chosen picked files in the "Additional Files" menu &lt;strong&gt;will not be added&lt;/strong&gt; to .exe file. To work around this you should use this code provided by developer of Auto PY to EXE &lt;a href="https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#debugging" rel="noopener noreferrer"&gt;here&lt;/a&gt; &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def resource_path(relative_path):
    """ Get absolute path to resource, works for dev and for PyInstaller """
try:
    # PyInstaller creates a temp folder and stores path in _MEIPASS
    base_path = sys._MEIPASS
except Exception:
    base_path = os.path.abspath(".")

return os.path.join(base_path, relative_path)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To use this code in your project replace the link to the media file you have &lt;em&gt;now&lt;/em&gt;&lt;br&gt;
For example:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setWindowIcon(QIcon('media\icons\logo.png'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;with&lt;/em&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setWindowIcon(QIcon(resource_path('logo.png'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now the link will be referenced correctly and chosen files successfully packed into .exe file.&lt;/p&gt;

&lt;p&gt;For comparison:&lt;br&gt;
Possible link before&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"C:\Users\User\PycharmProjects\media\icons\logo.png"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Possible link after&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"C:\Users\User\AppData\Local\Temp\\_MEI34121\logo.png"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Press &lt;strong&gt;CONVERT .PY TO .EXE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwarehouse-camo.cmh1.psfhosted.org%2Fd2f89e7dfcbbd3635e0f098b43dbc9df7c74b7a4%2F68747470733a2f2f692e696d6775722e636f6d2f663354456e5a492e706e67" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwarehouse-camo.cmh1.psfhosted.org%2Fd2f89e7dfcbbd3635e0f098b43dbc9df7c74b7a4%2F68747470733a2f2f692e696d6775722e636f6d2f663354456e5a492e706e67" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wait&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwarehouse-camo.cmh1.psfhosted.org%2Fa71bb45213b2285ac68eedc2994709c478deb12d%2F68747470733a2f2f692e696d6775722e636f6d2f4d6a644f4e63432e706e67" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwarehouse-camo.cmh1.psfhosted.org%2Fa71bb45213b2285ac68eedc2994709c478deb12d%2F68747470733a2f2f692e696d6775722e636f6d2f4d6a644f4e63432e706e67" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3. Run your program!
&lt;/h2&gt;

&lt;p&gt;Now everything is done!&lt;/p&gt;

&lt;p&gt;Run it. Test it. See what`s up.&lt;/p&gt;

&lt;p&gt;Make sure everything works well.&lt;/p&gt;

&lt;h4&gt;
  
  
  You made One Directory
&lt;/h4&gt;

&lt;p&gt;Every file you need should be in the &lt;strong&gt;single directory&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  You made One File
&lt;/h4&gt;

&lt;p&gt;This way you should have &lt;strong&gt;single .exe file&lt;/strong&gt;. If you had a need and if done correctly your .exe file will be packed with all media inside it. &lt;strong&gt;You will not need any media files/folders present with .exe file&lt;/strong&gt; for it to display them properly.&lt;/p&gt;




&lt;h3&gt;
  
  
  P.S.
&lt;/h3&gt;

&lt;p&gt;If you have any feedback or suggestions on what important information should be added feel free to let me know!&lt;br&gt;
This guide is not a description of every possible option done every possible way.&lt;br&gt;
I hope you found that information useful!&lt;br&gt;
Good luck with your projects!&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>Rename your files depending on .extension!</title>
      <dc:creator>Eshleron</dc:creator>
      <pubDate>Wed, 16 Jan 2019 17:00:53 +0000</pubDate>
      <link>https://forem.com/eshleron/rename-your-files-depending-on-extension-2fkl</link>
      <guid>https://forem.com/eshleron/rename-your-files-depending-on-extension-2fkl</guid>
      <description>&lt;h1&gt;
  
  
  Useful tool
&lt;/h1&gt;

&lt;p&gt;If you want to rename your &lt;strong&gt;dataset samples for ML&lt;/strong&gt; and you might have a lot of them (you should btw) or maybe you need to set &lt;strong&gt;different enumeration for every .extension&lt;/strong&gt; you have or you just want to &lt;strong&gt;rename some personal stuff&lt;/strong&gt; I am glad you are here.&lt;/p&gt;

&lt;p&gt;This is how you can rename your files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For every .extension in the target folder reNamer sets unique enumeration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1hjuwusroko9bzjul0xj.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1hjuwusroko9bzjul0xj.PNG" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Randomly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcdtb2y1sp513rkpp8wc6.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcdtb2y1sp513rkpp8wc6.JPG" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With your set of parameters. Example, name=FILE, start counting from=10, step=1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwcz4462bu034huybk804.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwcz4462bu034huybk804.JPG" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Finally
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;It is simple application but I hope it would be as useful to someone as it has been useful to me!&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  If you want .exe?
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://mega.nz/#!35UGwCCD!zUn_Jg8pvimJgFV0DbgBzGpbPXRasqBTCGHnCjYgan8" rel="noopener noreferrer"&gt;Download&lt;/a&gt; &lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Eshleron" rel="noopener noreferrer"&gt;
        Eshleron
      &lt;/a&gt; / &lt;a href="https://github.com/Eshleron/reNamer" rel="noopener noreferrer"&gt;
        reNamer
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Rename files depending on their extension
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;reNamer&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;reNamer lets you rename files depending on their extension.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;How it works&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;reNamer allows you to rename files these ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For every .extension in the target folder reNamer sets unique enumeration.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/Eshleron/reNamer/blob/master/media/Examples/type_example.PNG?raw=true"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FEshleron%2FreNamer%2Fraw%2Fmaster%2Fmedia%2FExamples%2Ftype_example.PNG%3Fraw%3Dtrue" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Randomly&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/Eshleron/reNamer/blob/master/media/Examples/random_example.JPG?raw=true"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FEshleron%2FreNamer%2Fraw%2Fmaster%2Fmedia%2FExamples%2Frandom_example.JPG%3Fraw%3Dtrue" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;With your set of parameters. Example, name=FILE, start counting from=10, step=1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/Eshleron/reNamer/blob/master/media/Examples/FILE_example.JPG?raw=true"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FEshleron%2FreNamer%2Fraw%2Fmaster%2Fmedia%2FExamples%2FFILE_example.JPG%3Fraw%3Dtrue" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Where can use it?&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;You can use that as a tool to rename you training dataset files.
And simply you have a lot of files and you need the same pattern to rename them.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Prerequisites:&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;The only dependency that needs to be installed to run it is PyQt5 compatible with Python 3.5.4.
All other libraries used in this project are preinstalled in Python.&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Eshleron/reNamer" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


</description>
      <category>python</category>
      <category>rename</category>
      <category>beginners</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
