From d150476e98f1c47ae642451c77ba2ec0e99bac46 Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Sun, 12 Jan 2014 19:30:01 -0500 Subject: [PATCH] Added comments and console output to expain that you cannot run bitmessageapi.py directly --- src/bitmessageapi.py | 15 ++++++++++++--- src/bitmessagemain.py | 22 +++++++++------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/bitmessageapi.py b/src/bitmessageapi.py index cc0008b4..7bcc6836 100644 --- a/src/bitmessageapi.py +++ b/src/bitmessageapi.py @@ -1,6 +1,15 @@ -# Copyright (c) 2012 Jonathan Warren -# Copyright (c) 2012 The Bitmessage developers -# Moved API stuff from main program to here /EM +# Copyright (c) 2012-2014 Jonathan Warren +# Copyright (c) 2012-2014 The Bitmessage developers + +comment= """ +This is not what you run to run the Bitmessage API. Instead, enable daemon mode +( https://bitmessage.org/wiki/Daemon ) then run bitmessagemain.py. +""" + +if __name__ == "__main__": + print comment + import sys + sys.exit(0) from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler import json diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index a5fa60dc..06e2fdaa 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -14,16 +14,6 @@ import signal # Used to capture a Ctrl-C keypress so that Bitmessage can shutdo import singleton import os - -# OSX python version check -import sys -if sys.platform == 'darwin': - if float("{1}.{2}".format(*sys.version_info)) < 7.5: - msg = "You should use python 2.7.5 or greater. Your version: %s", "{0}.{1}.{2}".format(*sys.version_info) - logger.critical(msg) - print msg - sys.exit(0) - from SimpleXMLRPCServer import SimpleXMLRPCServer from bitmessageapi import MySimpleXMLRPCRequestHandler @@ -31,7 +21,6 @@ import shared from helper_sql import sqlQuery import threading - # Classes #from helper_sql import * #from class_sqlThread import * @@ -49,11 +38,19 @@ from debug import logger # Helper Functions import helper_bootstrap import helper_generic -#import proofofwork from subprocess import call import time +# OSX python version check +import sys +if sys.platform == 'darwin': + if float("{1}.{2}".format(*sys.version_info)) < 7.5: + msg = "You should use python 2.7.5 or greater. Your version: %s", "{0}.{1}.{2}".format(*sys.version_info) + logger.critical(msg) + print msg + sys.exit(0) + def connectToStream(streamNumber): shared.streamsInWhichIAmParticipating[streamNumber] = 'no data' selfInitiatedConnections[streamNumber] = {} @@ -87,7 +84,6 @@ class singleAPI(threading.Thread): # This is a list of current connections (the thread pointers at least) selfInitiatedConnections = {} - if shared.useVeryEasyProofOfWorkForTesting: shared.networkDefaultProofOfWorkNonceTrialsPerByte = int( shared.networkDefaultProofOfWorkNonceTrialsPerByte / 16)