<?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>DEV Community: crhodes</title>
    <description>The latest articles on DEV Community by crhodes (@crhodes2).</description>
    <link>https://dev.to/crhodes2</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%2F37563%2Fd643833d-b5b5-4fee-be05-81091322408e.png</url>
      <title>DEV Community: crhodes</title>
      <link>https://dev.to/crhodes2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/crhodes2"/>
    <language>en</language>
    <item>
      <title>Question: Importing Error with Flask and Cucumber</title>
      <dc:creator>crhodes</dc:creator>
      <pubDate>Tue, 08 Mar 2022 21:15:21 +0000</pubDate>
      <link>https://dev.to/crhodes2/question-importing-error-with-flask-and-cucumber-8k4</link>
      <guid>https://dev.to/crhodes2/question-importing-error-with-flask-and-cucumber-8k4</guid>
      <description>&lt;p&gt;I am working on a project with the following tree structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Project
  - Source
  - Web
       - test
         - features
            testing.features
         - steps
            testing.py
       - app
         - __init__.py
         - blueprints
            communication_bp.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I am working on a cucumber test code using the behave module and the folder I am working on is the test folder, which include features and steps.&lt;/p&gt;

&lt;p&gt;What I am trying to do is to import some methods found in &lt;code&gt;communication_bp.py&lt;/code&gt; from the app folder into the cucumber test file &lt;code&gt;testing.py&lt;/code&gt; in python.&lt;/p&gt;

&lt;p&gt;So Line 3 is what I am trying to achieve.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;testing.py:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from behave_restful import *
import requests
from blueprints.communication_bp import client_comm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;but I keep getting this error.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  File "../steps/testing.py", line 3, in &amp;lt;module&amp;gt;
    from blueprints.communication_bp import client_comm
ModuleNotFoundError: No module named 'blueprints'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Based on what I have read, the app folder is supposed to have &lt;code&gt;__init__.py&lt;/code&gt;, which it does.&lt;/p&gt;

&lt;p&gt;I will include what both this file and &lt;code&gt;communication_bp.py file&lt;/code&gt; here as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;strong&gt;init&lt;/strong&gt;.py&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask
from flask_cors import CORS
from flask_jwt_extended import JWTManager
from flask_socketio import SocketIO

# Create the Flask application
rest = Flask(__name__)
...
...
from app.blueprints.communication_bp import communication_bp
...
...

rest.register_blueprint(communication_bp, url_prefix = Config.API_PREFIX)
...
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;communication_bp.py&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sys
import json
from flask import Blueprint, request
...
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;So what exactly does this program wants? What am I missing here?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>TypeError: 'int' object is not subscriptable</title>
      <dc:creator>crhodes</dc:creator>
      <pubDate>Wed, 25 Jul 2018 23:10:22 +0000</pubDate>
      <link>https://dev.to/crhodes2/typeerror-int-object-is-not-subscriptable-34f8</link>
      <guid>https://dev.to/crhodes2/typeerror-int-object-is-not-subscriptable-34f8</guid>
      <description>&lt;p&gt;So here is the situation: I have a json object, requested from a 3rd party source, that has a list of items. 14 of them.&lt;/p&gt;

&lt;p&gt;I am able to display them all by count: ie. 0,1,2,3...13. This is what I used to display them.&lt;/p&gt;

&lt;p&gt;x = my_request["jsonObject"]["items"]&lt;br&gt;
for ex in range(x):&lt;br&gt;
  print(ex)&lt;/p&gt;

&lt;p&gt;But each one of these items have additional attributes from within and I want to access at least one item's attribute. Let's say the one I want to access is "item_color", and according to the jSON file it is nested with other attribute.&lt;/p&gt;

&lt;p&gt;This was my attempt:&lt;br&gt;
for ex in x:&lt;br&gt;
  print(ex["itemInfo"]["color"]) &lt;/p&gt;

&lt;p&gt;But I get an 'int' object is not subscriptable.&lt;/p&gt;

&lt;p&gt;Is there a way for me to display the attribute that I want to display on the console, just like how I displayed all the items by count?&lt;/p&gt;

&lt;p&gt;Please find a screenshot of the json object I am manipulating below to get a better idea.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.dropbox.com/s/apao25r9j2b22ir/Screen%20Shot%202018-07-25%20at%204.07.36%20PM.png?dl=0"&gt;https://www.dropbox.com/s/apao25r9j2b22ir/Screen%20Shot%202018-07-25%20at%204.07.36%20PM.png?dl=0&lt;/a&gt;&lt;/p&gt;

</description>
      <category>help</category>
    </item>
    <item>
      <title>Sending a GET Request to GitHub API asking for a list of commit messages in a Pull Request</title>
      <dc:creator>crhodes</dc:creator>
      <pubDate>Tue, 24 Jul 2018 23:12:53 +0000</pubDate>
      <link>https://dev.to/crhodes2/sending-a-get-request-to-github-api-asking-for-a-list-of-commit-messages-in-a-pull-request-2kjm</link>
      <guid>https://dev.to/crhodes2/sending-a-get-request-to-github-api-asking-for-a-list-of-commit-messages-in-a-pull-request-2kjm</guid>
      <description>&lt;p&gt;I want my Python Flask server to send a GET Request to the GitHub REST API V3, asking for all commits messages in a Pull Request, and perhaps receive it as a single payload.&lt;/p&gt;

&lt;p&gt;Any suggestions on how I can approach this issue?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Which Programming language are GitHub Apps mostly written in?</title>
      <dc:creator>crhodes</dc:creator>
      <pubDate>Fri, 29 Jun 2018 15:56:28 +0000</pubDate>
      <link>https://dev.to/crhodes2/which-programming-language-are-github-apps-mostly-written-in-3b80</link>
      <guid>https://dev.to/crhodes2/which-programming-language-are-github-apps-mostly-written-in-3b80</guid>
      <description>&lt;p&gt;And I'm not talking about a REAL app that would replace or alternate GitHub's functionality. I'm talking about an app that extends and uses the functionality of GitHub, according to &lt;a href="http://developer.github.com/apps/marketplace"&gt;developer.github.com/apps/marketplace&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm not really familiar with developing an application as an extension of another application, but based on what I have read it can support node.JS as its programming language.&lt;/p&gt;

&lt;p&gt;Some of these extensions if you look into the website show supports of other languages but I have no way of knowing or confirming if its the app itself that were written in these languages or they support applications that are written in these languages? &lt;/p&gt;

&lt;p&gt;So, what say you, the experts on this area, are GitHub Apps only written in node.js? If not, can they be written in other languages and what are these languages?&lt;/p&gt;

</description>
      <category>github</category>
      <category>discuss</category>
    </item>
    <item>
      <title>C++ Array List</title>
      <dc:creator>crhodes</dc:creator>
      <pubDate>Tue, 05 Dec 2017 03:04:11 +0000</pubDate>
      <link>https://dev.to/crhodes2/c-array-list-cej</link>
      <guid>https://dev.to/crhodes2/c-array-list-cej</guid>
      <description>

&lt;p&gt;I am trying to solve the algorithm of finding and displaying the largest age in the array. This is what I have so far.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;

using namespace std;

int main()
{
    int brothers[5] = {6,3,24,12,22};
    int i = 0;
    int eldestAge = 0;

    for (int j = 0; j &amp;lt; brothers[i]; ++j)
        {
            if (eldestAge &amp;lt; brothers[i])
            {
                eldestAge = brothers[i];
            }
            else
            {
                // do nothing
            }
        }

        cout &amp;lt;&amp;lt; "Eldest Age is = " + eldestAge &amp;lt;&amp;lt; endl;

        system("pause");
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;However the output doesn't display anything except the quote. Please let me know what am I doing wrong.&lt;/p&gt;


</description>
      <category>c</category>
      <category>arrays</category>
    </item>
    <item>
      <title>How to fix an Endless Loop in Python?</title>
      <dc:creator>crhodes</dc:creator>
      <pubDate>Tue, 17 Oct 2017 02:17:45 +0000</pubDate>
      <link>https://dev.to/crhodes2/how-to-fix-an-endless-loop-in-python-c3p</link>
      <guid>https://dev.to/crhodes2/how-to-fix-an-endless-loop-in-python-c3p</guid>
      <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;This is my first time here on dev.to. I need some help fixing a code.&lt;br&gt;
See I'm learning Python from scratch and created this simple game program using Python that randomly rolls a dice in Visual Studio 2015.&lt;/p&gt;

&lt;p&gt;But two problems have risen from my program. The first problem is that the dice doesn't exactly roll randomly. It will give me the random number but the numbers will not change until I close the program and only then do I close the program that it will give me another random set of numbers again.&lt;/p&gt;

&lt;p&gt;The second problem I have found is when I run the code, it goes into an endless loop. I'm not sure how I am able to make this loop endless but I don't know how to stop it. If anyone can help me fix my mistakes, I'd really appreciate it.&lt;/p&gt;

&lt;p&gt;Please find my code here.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random
min = 1
max = 6
dice = random.randint(1, 6)
dice2 = random.randint(1, 6)

roll_again = "yes"

while roll_again == "yes" or roll_again == "y":
    print "Rolling the dices..."
    print "The values are...."
    print dice
    print dice2

if(dice + dice2 == 6):
    print("You rolled a 6! You have been cursed!")
elif(dice + dice2 == 7):
    print("You rolled a 7! You have been blessed with money")
else:
    print("You don't have any blessings")

roll_again = raw_input("Roll the dices again?")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Thank you in advance.&lt;/p&gt;

</description>
      <category>python</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
