Python - Additional “members” appended to JSON object when passing it to function
I have the following JSON object located in its own file called build.json:
{
"name": "utils",
"version": "1.0.0",
"includes": ,
"libraries": ,
"testLibraries":
}
I obtain this object in my Python program using the following method:
def getPackage(packageName):
jsonFilePath = os.path.join(SRCDIR, packageName, "build.json")
packageJson = None
try:
with open(jsonFilePath, "r") as jsonFile:
packageJson = json.load(jsonFile)
except:
return None
return packageJson
I verify that the JSON object for the current package (which is one of many packages I am iterating over) did not come back None in the following method. Note that I am temporarily printing out the keys of the dictionary:
def compileAllPackages():
global COMPILED_PACKAGES
for packageName in os.listdir(SRCDIR):
package = getPackage(packageName)
if package == None:
continue
# TEMP ==============
for i in package:
print(i)
# ===================
compiledSuccessfully = compilePackage(package)
if not compiledSuccessfully:
return False
return True
Lastly, I am currently also printing out the keys of the dictionary once it is received in the compilePackage function:
def compilePackage(package):
global COMPILED_PACKAGES, INCLUDE_TESTS
# TEMP ==============
for i in package:
print(i)
# ===================
...
Output from compileAllPackages function:
name
version
includes
libraries
testLibraries
Output from compilePackage function:
name
version
includes
libraries
testLibraries
u
t
i
l
s
I can not for the life of me figure out what is happening to my dictionary during that function call??? Please note that the build.json file is located within a directory named "utils".
Edit:
The Python script is located separate from the build.json file and works on absolute paths. It should also be noted that after getting that strange output, I also get the following exception when trying to access a valid key later (it seems to think the dictionary is a string?...):
Traceback (most recent call last):
File "/Users/nate/bin/BuildTool/unix/build.py", line 493, in <module>
main()
File "/Users/nate/bin/BuildTool/unix/build.py", line 481, in main
compiledSuccessfully = compileAllPackages()
File "/Users/nate/bin/BuildTool/unix/build.py", line 263, in compileAllPackages
compiledSuccessfully = compilePackage(package)
File "/Users/nate/bin/BuildTool/unix/build.py", line 287, in compilePackage
compiledSuccessfully = compilePackage(include)
File "/Users/nate/bin/BuildTool/unix/build.py", line 279, in compilePackage
includes = getPackageIncludes(package)
File "/Users/nate/bin/BuildTool/unix/build.py", line 194, in getPackageIncludes
includes = [package["name"]] # A package always includes itself
TypeError: string indices must be integers
Edit: If I change the parameter name to something other than 'package', I no longer get that weird output or an exception later on. This is not necessarily a fix, however, as I do not know what could be wrong with the name 'package'. There are no globals named as such either.
python json python-3.x python-2.7 typeerror
add a comment |
I have the following JSON object located in its own file called build.json:
{
"name": "utils",
"version": "1.0.0",
"includes": ,
"libraries": ,
"testLibraries":
}
I obtain this object in my Python program using the following method:
def getPackage(packageName):
jsonFilePath = os.path.join(SRCDIR, packageName, "build.json")
packageJson = None
try:
with open(jsonFilePath, "r") as jsonFile:
packageJson = json.load(jsonFile)
except:
return None
return packageJson
I verify that the JSON object for the current package (which is one of many packages I am iterating over) did not come back None in the following method. Note that I am temporarily printing out the keys of the dictionary:
def compileAllPackages():
global COMPILED_PACKAGES
for packageName in os.listdir(SRCDIR):
package = getPackage(packageName)
if package == None:
continue
# TEMP ==============
for i in package:
print(i)
# ===================
compiledSuccessfully = compilePackage(package)
if not compiledSuccessfully:
return False
return True
Lastly, I am currently also printing out the keys of the dictionary once it is received in the compilePackage function:
def compilePackage(package):
global COMPILED_PACKAGES, INCLUDE_TESTS
# TEMP ==============
for i in package:
print(i)
# ===================
...
Output from compileAllPackages function:
name
version
includes
libraries
testLibraries
Output from compilePackage function:
name
version
includes
libraries
testLibraries
u
t
i
l
s
I can not for the life of me figure out what is happening to my dictionary during that function call??? Please note that the build.json file is located within a directory named "utils".
Edit:
The Python script is located separate from the build.json file and works on absolute paths. It should also be noted that after getting that strange output, I also get the following exception when trying to access a valid key later (it seems to think the dictionary is a string?...):
Traceback (most recent call last):
File "/Users/nate/bin/BuildTool/unix/build.py", line 493, in <module>
main()
File "/Users/nate/bin/BuildTool/unix/build.py", line 481, in main
compiledSuccessfully = compileAllPackages()
File "/Users/nate/bin/BuildTool/unix/build.py", line 263, in compileAllPackages
compiledSuccessfully = compilePackage(package)
File "/Users/nate/bin/BuildTool/unix/build.py", line 287, in compilePackage
compiledSuccessfully = compilePackage(include)
File "/Users/nate/bin/BuildTool/unix/build.py", line 279, in compilePackage
includes = getPackageIncludes(package)
File "/Users/nate/bin/BuildTool/unix/build.py", line 194, in getPackageIncludes
includes = [package["name"]] # A package always includes itself
TypeError: string indices must be integers
Edit: If I change the parameter name to something other than 'package', I no longer get that weird output or an exception later on. This is not necessarily a fix, however, as I do not know what could be wrong with the name 'package'. There are no globals named as such either.
python json python-3.x python-2.7 typeerror
2
I'm with @benediktwerner. I don't think the 'utils' part comes from anywhere in this code. Try searching for all other points in your code where you print and see if it might be coming from one of them. Better yet, print something before and after the for loops like say########
so you can properly demarcate where that part's output starts and ends.
– Karuhanga
Nov 9 '18 at 3:28
@Karuhanga I can comment out all of my printouts such that I get no output except for the exception. Then if I only allow that one print loop in the compilePackage function, the result is as seen above. I don't believe there is anything in the print buffer either that wasn't flushed before-hand.
– Nathaniel Rex
Nov 9 '18 at 3:55
Have you tried justprint(package)
and see what you got?
– Idlehands
Nov 9 '18 at 13:16
@Idlehands yes. If I replace each looping print with print(package) above, from compileAllPackages, I get:{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': }
and from compilePackage, I get (still with that weird utils string tacked onto the end):{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': } utils
– Nathaniel Rex
Nov 9 '18 at 14:46
add a comment |
I have the following JSON object located in its own file called build.json:
{
"name": "utils",
"version": "1.0.0",
"includes": ,
"libraries": ,
"testLibraries":
}
I obtain this object in my Python program using the following method:
def getPackage(packageName):
jsonFilePath = os.path.join(SRCDIR, packageName, "build.json")
packageJson = None
try:
with open(jsonFilePath, "r") as jsonFile:
packageJson = json.load(jsonFile)
except:
return None
return packageJson
I verify that the JSON object for the current package (which is one of many packages I am iterating over) did not come back None in the following method. Note that I am temporarily printing out the keys of the dictionary:
def compileAllPackages():
global COMPILED_PACKAGES
for packageName in os.listdir(SRCDIR):
package = getPackage(packageName)
if package == None:
continue
# TEMP ==============
for i in package:
print(i)
# ===================
compiledSuccessfully = compilePackage(package)
if not compiledSuccessfully:
return False
return True
Lastly, I am currently also printing out the keys of the dictionary once it is received in the compilePackage function:
def compilePackage(package):
global COMPILED_PACKAGES, INCLUDE_TESTS
# TEMP ==============
for i in package:
print(i)
# ===================
...
Output from compileAllPackages function:
name
version
includes
libraries
testLibraries
Output from compilePackage function:
name
version
includes
libraries
testLibraries
u
t
i
l
s
I can not for the life of me figure out what is happening to my dictionary during that function call??? Please note that the build.json file is located within a directory named "utils".
Edit:
The Python script is located separate from the build.json file and works on absolute paths. It should also be noted that after getting that strange output, I also get the following exception when trying to access a valid key later (it seems to think the dictionary is a string?...):
Traceback (most recent call last):
File "/Users/nate/bin/BuildTool/unix/build.py", line 493, in <module>
main()
File "/Users/nate/bin/BuildTool/unix/build.py", line 481, in main
compiledSuccessfully = compileAllPackages()
File "/Users/nate/bin/BuildTool/unix/build.py", line 263, in compileAllPackages
compiledSuccessfully = compilePackage(package)
File "/Users/nate/bin/BuildTool/unix/build.py", line 287, in compilePackage
compiledSuccessfully = compilePackage(include)
File "/Users/nate/bin/BuildTool/unix/build.py", line 279, in compilePackage
includes = getPackageIncludes(package)
File "/Users/nate/bin/BuildTool/unix/build.py", line 194, in getPackageIncludes
includes = [package["name"]] # A package always includes itself
TypeError: string indices must be integers
Edit: If I change the parameter name to something other than 'package', I no longer get that weird output or an exception later on. This is not necessarily a fix, however, as I do not know what could be wrong with the name 'package'. There are no globals named as such either.
python json python-3.x python-2.7 typeerror
I have the following JSON object located in its own file called build.json:
{
"name": "utils",
"version": "1.0.0",
"includes": ,
"libraries": ,
"testLibraries":
}
I obtain this object in my Python program using the following method:
def getPackage(packageName):
jsonFilePath = os.path.join(SRCDIR, packageName, "build.json")
packageJson = None
try:
with open(jsonFilePath, "r") as jsonFile:
packageJson = json.load(jsonFile)
except:
return None
return packageJson
I verify that the JSON object for the current package (which is one of many packages I am iterating over) did not come back None in the following method. Note that I am temporarily printing out the keys of the dictionary:
def compileAllPackages():
global COMPILED_PACKAGES
for packageName in os.listdir(SRCDIR):
package = getPackage(packageName)
if package == None:
continue
# TEMP ==============
for i in package:
print(i)
# ===================
compiledSuccessfully = compilePackage(package)
if not compiledSuccessfully:
return False
return True
Lastly, I am currently also printing out the keys of the dictionary once it is received in the compilePackage function:
def compilePackage(package):
global COMPILED_PACKAGES, INCLUDE_TESTS
# TEMP ==============
for i in package:
print(i)
# ===================
...
Output from compileAllPackages function:
name
version
includes
libraries
testLibraries
Output from compilePackage function:
name
version
includes
libraries
testLibraries
u
t
i
l
s
I can not for the life of me figure out what is happening to my dictionary during that function call??? Please note that the build.json file is located within a directory named "utils".
Edit:
The Python script is located separate from the build.json file and works on absolute paths. It should also be noted that after getting that strange output, I also get the following exception when trying to access a valid key later (it seems to think the dictionary is a string?...):
Traceback (most recent call last):
File "/Users/nate/bin/BuildTool/unix/build.py", line 493, in <module>
main()
File "/Users/nate/bin/BuildTool/unix/build.py", line 481, in main
compiledSuccessfully = compileAllPackages()
File "/Users/nate/bin/BuildTool/unix/build.py", line 263, in compileAllPackages
compiledSuccessfully = compilePackage(package)
File "/Users/nate/bin/BuildTool/unix/build.py", line 287, in compilePackage
compiledSuccessfully = compilePackage(include)
File "/Users/nate/bin/BuildTool/unix/build.py", line 279, in compilePackage
includes = getPackageIncludes(package)
File "/Users/nate/bin/BuildTool/unix/build.py", line 194, in getPackageIncludes
includes = [package["name"]] # A package always includes itself
TypeError: string indices must be integers
Edit: If I change the parameter name to something other than 'package', I no longer get that weird output or an exception later on. This is not necessarily a fix, however, as I do not know what could be wrong with the name 'package'. There are no globals named as such either.
python json python-3.x python-2.7 typeerror
python json python-3.x python-2.7 typeerror
edited Nov 9 '18 at 4:34
Nathaniel Rex
asked Nov 9 '18 at 2:57
Nathaniel RexNathaniel Rex
414
414
2
I'm with @benediktwerner. I don't think the 'utils' part comes from anywhere in this code. Try searching for all other points in your code where you print and see if it might be coming from one of them. Better yet, print something before and after the for loops like say########
so you can properly demarcate where that part's output starts and ends.
– Karuhanga
Nov 9 '18 at 3:28
@Karuhanga I can comment out all of my printouts such that I get no output except for the exception. Then if I only allow that one print loop in the compilePackage function, the result is as seen above. I don't believe there is anything in the print buffer either that wasn't flushed before-hand.
– Nathaniel Rex
Nov 9 '18 at 3:55
Have you tried justprint(package)
and see what you got?
– Idlehands
Nov 9 '18 at 13:16
@Idlehands yes. If I replace each looping print with print(package) above, from compileAllPackages, I get:{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': }
and from compilePackage, I get (still with that weird utils string tacked onto the end):{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': } utils
– Nathaniel Rex
Nov 9 '18 at 14:46
add a comment |
2
I'm with @benediktwerner. I don't think the 'utils' part comes from anywhere in this code. Try searching for all other points in your code where you print and see if it might be coming from one of them. Better yet, print something before and after the for loops like say########
so you can properly demarcate where that part's output starts and ends.
– Karuhanga
Nov 9 '18 at 3:28
@Karuhanga I can comment out all of my printouts such that I get no output except for the exception. Then if I only allow that one print loop in the compilePackage function, the result is as seen above. I don't believe there is anything in the print buffer either that wasn't flushed before-hand.
– Nathaniel Rex
Nov 9 '18 at 3:55
Have you tried justprint(package)
and see what you got?
– Idlehands
Nov 9 '18 at 13:16
@Idlehands yes. If I replace each looping print with print(package) above, from compileAllPackages, I get:{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': }
and from compilePackage, I get (still with that weird utils string tacked onto the end):{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': } utils
– Nathaniel Rex
Nov 9 '18 at 14:46
2
2
I'm with @benediktwerner. I don't think the 'utils' part comes from anywhere in this code. Try searching for all other points in your code where you print and see if it might be coming from one of them. Better yet, print something before and after the for loops like say
########
so you can properly demarcate where that part's output starts and ends.– Karuhanga
Nov 9 '18 at 3:28
I'm with @benediktwerner. I don't think the 'utils' part comes from anywhere in this code. Try searching for all other points in your code where you print and see if it might be coming from one of them. Better yet, print something before and after the for loops like say
########
so you can properly demarcate where that part's output starts and ends.– Karuhanga
Nov 9 '18 at 3:28
@Karuhanga I can comment out all of my printouts such that I get no output except for the exception. Then if I only allow that one print loop in the compilePackage function, the result is as seen above. I don't believe there is anything in the print buffer either that wasn't flushed before-hand.
– Nathaniel Rex
Nov 9 '18 at 3:55
@Karuhanga I can comment out all of my printouts such that I get no output except for the exception. Then if I only allow that one print loop in the compilePackage function, the result is as seen above. I don't believe there is anything in the print buffer either that wasn't flushed before-hand.
– Nathaniel Rex
Nov 9 '18 at 3:55
Have you tried just
print(package)
and see what you got?– Idlehands
Nov 9 '18 at 13:16
Have you tried just
print(package)
and see what you got?– Idlehands
Nov 9 '18 at 13:16
@Idlehands yes. If I replace each looping print with print(package) above, from compileAllPackages, I get:
{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': }
and from compilePackage, I get (still with that weird utils string tacked onto the end): {'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': } utils
– Nathaniel Rex
Nov 9 '18 at 14:46
@Idlehands yes. If I replace each looping print with print(package) above, from compileAllPackages, I get:
{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': }
and from compilePackage, I get (still with that weird utils string tacked onto the end): {'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': } utils
– Nathaniel Rex
Nov 9 '18 at 14:46
add a comment |
2 Answers
2
active
oldest
votes
The answer ended up being very stupid. compilePackage() has the possibility of being called recursively, due to any dependencies the package may rely on. In recursive calls to the function, I was passing a string to the function rather than a dictionary.
add a comment |
I tried your code and the result is like this
Output from compileAllPackages function:
name
version
includes
libraries
testLibraries
Output from compilePackage function:
name
version
includes
libraries
testLibraries
My directory structure is like this
├── test.py
└── tt
└── cc
└── utils
└── build.json
I think your code is correct, it should be that the path parameter you passed is incorrect.
it should be that the path parameter you passed is incorrect
. This does not explain why you would have different output for identical pieces of code.
– Karuhanga
Nov 9 '18 at 3:31
This is not an answer and must be posted as a comment.
– DYZ
Nov 9 '18 at 3:40
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219213%2fpython-additional-members-appended-to-json-object-when-passing-it-to-functio%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The answer ended up being very stupid. compilePackage() has the possibility of being called recursively, due to any dependencies the package may rely on. In recursive calls to the function, I was passing a string to the function rather than a dictionary.
add a comment |
The answer ended up being very stupid. compilePackage() has the possibility of being called recursively, due to any dependencies the package may rely on. In recursive calls to the function, I was passing a string to the function rather than a dictionary.
add a comment |
The answer ended up being very stupid. compilePackage() has the possibility of being called recursively, due to any dependencies the package may rely on. In recursive calls to the function, I was passing a string to the function rather than a dictionary.
The answer ended up being very stupid. compilePackage() has the possibility of being called recursively, due to any dependencies the package may rely on. In recursive calls to the function, I was passing a string to the function rather than a dictionary.
answered Nov 18 '18 at 22:06
Nathaniel RexNathaniel Rex
414
414
add a comment |
add a comment |
I tried your code and the result is like this
Output from compileAllPackages function:
name
version
includes
libraries
testLibraries
Output from compilePackage function:
name
version
includes
libraries
testLibraries
My directory structure is like this
├── test.py
└── tt
└── cc
└── utils
└── build.json
I think your code is correct, it should be that the path parameter you passed is incorrect.
it should be that the path parameter you passed is incorrect
. This does not explain why you would have different output for identical pieces of code.
– Karuhanga
Nov 9 '18 at 3:31
This is not an answer and must be posted as a comment.
– DYZ
Nov 9 '18 at 3:40
add a comment |
I tried your code and the result is like this
Output from compileAllPackages function:
name
version
includes
libraries
testLibraries
Output from compilePackage function:
name
version
includes
libraries
testLibraries
My directory structure is like this
├── test.py
└── tt
└── cc
└── utils
└── build.json
I think your code is correct, it should be that the path parameter you passed is incorrect.
it should be that the path parameter you passed is incorrect
. This does not explain why you would have different output for identical pieces of code.
– Karuhanga
Nov 9 '18 at 3:31
This is not an answer and must be posted as a comment.
– DYZ
Nov 9 '18 at 3:40
add a comment |
I tried your code and the result is like this
Output from compileAllPackages function:
name
version
includes
libraries
testLibraries
Output from compilePackage function:
name
version
includes
libraries
testLibraries
My directory structure is like this
├── test.py
└── tt
└── cc
└── utils
└── build.json
I think your code is correct, it should be that the path parameter you passed is incorrect.
I tried your code and the result is like this
Output from compileAllPackages function:
name
version
includes
libraries
testLibraries
Output from compilePackage function:
name
version
includes
libraries
testLibraries
My directory structure is like this
├── test.py
└── tt
└── cc
└── utils
└── build.json
I think your code is correct, it should be that the path parameter you passed is incorrect.
answered Nov 9 '18 at 3:29
老板鱼丸粗面老板鱼丸粗面
11
11
it should be that the path parameter you passed is incorrect
. This does not explain why you would have different output for identical pieces of code.
– Karuhanga
Nov 9 '18 at 3:31
This is not an answer and must be posted as a comment.
– DYZ
Nov 9 '18 at 3:40
add a comment |
it should be that the path parameter you passed is incorrect
. This does not explain why you would have different output for identical pieces of code.
– Karuhanga
Nov 9 '18 at 3:31
This is not an answer and must be posted as a comment.
– DYZ
Nov 9 '18 at 3:40
it should be that the path parameter you passed is incorrect
. This does not explain why you would have different output for identical pieces of code.– Karuhanga
Nov 9 '18 at 3:31
it should be that the path parameter you passed is incorrect
. This does not explain why you would have different output for identical pieces of code.– Karuhanga
Nov 9 '18 at 3:31
This is not an answer and must be posted as a comment.
– DYZ
Nov 9 '18 at 3:40
This is not an answer and must be posted as a comment.
– DYZ
Nov 9 '18 at 3:40
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219213%2fpython-additional-members-appended-to-json-object-when-passing-it-to-functio%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
I'm with @benediktwerner. I don't think the 'utils' part comes from anywhere in this code. Try searching for all other points in your code where you print and see if it might be coming from one of them. Better yet, print something before and after the for loops like say
########
so you can properly demarcate where that part's output starts and ends.– Karuhanga
Nov 9 '18 at 3:28
@Karuhanga I can comment out all of my printouts such that I get no output except for the exception. Then if I only allow that one print loop in the compilePackage function, the result is as seen above. I don't believe there is anything in the print buffer either that wasn't flushed before-hand.
– Nathaniel Rex
Nov 9 '18 at 3:55
Have you tried just
print(package)
and see what you got?– Idlehands
Nov 9 '18 at 13:16
@Idlehands yes. If I replace each looping print with print(package) above, from compileAllPackages, I get:
{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': }
and from compilePackage, I get (still with that weird utils string tacked onto the end):{'name': 'utils', 'version': '1.0.0', 'includes': , 'libraries': , 'testLibraries': } utils
– Nathaniel Rex
Nov 9 '18 at 14:46