I am trying to run my script using brownie but I am getting a constant error and I searched everywhere I didn't get the answer :
def main(): print("hello bruh")
I need to run my codes using brownie run scripts/deploy.py
the error : Successfully installed docopt-0.6.2
PS C:\Users\brosky\Desktop\solidity\Blockchain-development\brownie_simple_storage> brownie run scripts/deploy.py
INFO: Could not find files for the given pattern(s).
Brownie v1.19.3 - Python development framework for Ethereum
File "C:\Users\brosky\AppData\Local\Programs\Python\Python311\Lib\site-packages\brownie_cli_main_.py", line 64, in main
importlib.import_module(f"brownie.cli.{cmd}").main()
File "C:\Users\brosky\AppData\Local\Programs\Python\Python311\Lib\site-packages\brownie_cli\run.py", line 36, in main
args = docopt(doc, more_magic=True)
File "C:\Users\brosky\AppData\Local\Programs\Python\Python311\Lib\site-packages\brownie\utils\docopt.py", line 814, in docopt
assert instr.opname.startswith("CALL")
AssertionError:
Related
Situation:
I have created a simple dash Cytoscape application, compile it into an executable file using Pyinstaller and tried running it on different computers in the same network all without issues. However, when I tried running it on a different network, I got back an error msg as follows:
File "dash\dash.py", in run_server
self.server.run(host=host, port=port, debug=debug, **flask_run_options)
File "flask\app.py, in run
File "werkzeug\serving.py, in run_simple
File "werkzeug\serving.py, in inner
File "werkzeug\serving.py, in make_server
File "werkzeug\serving.py, in __init__
File "socketserver.py", in __init__
File "socket.py", in __init__
OSError: [WinError 10022] An invalid argument was supplied
Failed to execute script 'Application' due to unhandled exception!
Dash Cytoscape Application script that returns an error when running the executable file:
def open_browser():
webbrowser.open_new('http://127.0.0.1:5000/')
if __name__=='__main__'
Timer(2,open_browser).start()
app.run_server(port=5000, debug=False)
Just wondering why the other computer on the same network is able to launch the executable file but not those on another network? To add on the port 5000 is not in use. Hope to get some clarity and direction on StackOverflow. Appreciate all help.
I got access to a private GitLab project that contains the following branches: main, develop and new_branch. The machine learning project is pretty complex and contains various transformers for NLP, and many steps that generate some output from an input text. FastAPI has also been used.
I am trying to see how this works and run it. I use Windows. I know that I need Python 3.9 and to have pipenv installed and then the following instructions are given:
Install all dependencies locally by running `pipenv install --dev`.
Create an empty file named `.env` inside the root project folder.
Copy and paste the contents of the `.env.example` file into `.env`.
Run `pipenv run prebuild-win` to download the necessary static files needed by 3rd party libraries.
Run API using the following command: `pipenv run start`. Go to `http://localhost:8000/`.
I opened git CMD, cloned it, and it's the develop branch that appears in the folder (for the new_branch it says Pipeline: failed). I navigated to the folder of the project, created a virtual environment and installed the dependencies. The file that in GitLab was called .env.example already appear in my folder as .env with the necessary contents. I run pipenv run prebuild-win and everything else gets installed.
But when I run API using pipenv run start, I get:
Traceback (most recent call last):
File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\me\the-project\app\main.py", line 25, in <module>
api = Api()
File "C:\Users\me\the-project\app\main.py", line 13, in __init__
self.config_service = ConfigService()
File "C:\Users\me\the-project\app\core\config.py", line 17, in __init__
self.port = int(os.getenv('PORT'))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Did I do anything wrong?
I checked and there is a port, and I think it's because I skipped the creating an .env file step. I created an empty text file, copy and pasted the contents, and I get the same error. The .env.example contains:
APP_NAME=My app
VERSION=0.0.1
HOST=127.0.0.1
PORT=1234
int(os.getenv('PORT'))
This line tries to read the environment variable PORT and convert it to an integer.
The fact that you get the error
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
indicates that os.getenv('PORT') returned None, i.e. that the environment variable did not exist.
You need to find out how to set the appropriate environment variables. Apparently writing them into a file called .env isn't sufficient.
I am trying to run a code I downloaded from https://github.com/szieleniewski/NIFSIM to analyze data from JWSTelescope. While running the main file, jwsim.py, I get a module error on one of the definitions.
I am currently using Python 3.7, Ubuntu 16.04, and I work under an environment (called webbpsf-env). These details can not be changed, since WebbPSF (a program I am using with the code) requires such versions to work. The main jsim.py file is stored in the Downloads folder.
I get the following error:
(webbpsf-env) aleejandrof#aleejandrof-Satellite-C55t-B:~/Downloads/NIFSIM-master$ python jsim.py
*File* "jsim.py", line 18, in <module>
*from* src.JSIM_main *import* main
File "/home/aleejandrof/Downloads/NIFSIM-master/src/JSIM_main.py", line 22, in <module>
*from* JSIM_Specres *import* spectral_res
ModuleNotFoundError: No module named 'JSIM_Specres'
The mentioned line is this one:
from JSIM_Specres import spectral_res
I've been told, that if I work ouside the environment, the module could be found. For me this is not an option since Webbpsf requires working inside an environment. I have tried downloading the master file again inside the environment (through pip), but it could not be done. Is there a way to "insert" a file into an environment? what should I do?
The author likely anticipated you had a certain env var set. Try this:
$ cd ../NIFSIM-master && env PYTHONPATH=.:src python jsim.py
I'm using the latest version of pycharm 2018.2, on Windows.
I've also updated the Google Cloud Sdk to the latest versions too.
When I use the built in App Engine run configuration in Pycharm:
I get an import error ImportError: cannot import name _common appearing in the run window:
"C:\Program Files\JetBrains\PyCharm 2018.1.1\bin\runnerw.exe" C:\Code\my-
project\env\Scripts\python.exe "C:/Program Files (x86)/Google/Cloud
SDK/google-cloud-sdk/bin/dev_appserver.py" --port 8484 app.yaml tasks.yaml
longtasks.yaml --log_level=debug Traceback (most recent call last):
File "C:/Program Files (x86)/Google/Cloud SDK/google-cloud-
sdk/bin/dev_appserver.py", line 12, in <module>
from bootstrapping import bootstrapping
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-
sdk\bin\bootstrapping\bootstrapping.py", line 24, in <module>
from . import setup # pylint:disable=g-import-not-at-top
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-
sdk\bin\bootstrapping\setup.py", line 55, in <module>
from googlecloudsdk.core import properties
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-
sdk\lib\googlecloudsdk\core\properties.py", line 36, in <module>
from googlecloudsdk.core.util import times
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-
sdk\lib\googlecloudsdk\core\util\times.py", line 55, in <module>
from dateutil.tz import _common as tz_common
ImportError: cannot import name _common
Process finished with exit code 1
The dateutil.tz package is located in C:\Python27\Lib\site-packages and I have a dateutil package in the project I'm running. I don't know whether that has something to do with the issue. I've tried changing the default python interpreter which also did not work. I've tried running Pycharm as administrator which also had no effect. Both the debug and non-debug run commands result in this issue.
If I run the command to start up dev_appserver.py directly in the terminal (with or without virtual environment python), it works correctly e.g. "C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin/dev_appserver.py" --port 8484 app.yaml tasks.yaml longtasks.yaml
Also, if I run the command that pycharm is running (except for the runnerw part), then it works correctly (from command line) too:
C:\Code\project>C:\Code\project\env\Scripts\python.exe "C:/Program Files
(x86)/Google/Cloud SDK/google-cloud-sdk/bin/dev_appserver.py" --port 8484
app.yaml tasks.yaml longtasks.yaml --log_level=debug
INFO 2018-07-29 08:11:15,566 devappserver2.py:178] Skipping SDK update
check.
INFO 2018-07-29 08:11:17,726 api_server.py:274] Starting API server at:
http://localhost:59886
INFO 2018-07-29 08:11:18,259 dispatcher.py:270] Starting module
"default" running at: http://localhost:8484
INFO 2018-07-29 08:11:18,519 dispatcher.py:270] Starting module "tasks"
running at: http://localhost:8485
INFO 2018-07-29 08:11:18,815 dispatcher.py:270] Starting module
"longtasks" running at: http://localhost:8486
INFO 2018-07-29 08:11:18,822 admin_server.py:152] Starting admin server
at: http://localhost:8000
It's also worth noting that I can run other GAE projects in Pycharm and they do run (which leads me to think it's something to do with my configuration of this project).
This is a bug in 2018.2.4 of PyCharm Pro. I had the same issue, and rolled back to 2018.1.5 and it worked fine.
The problem is that 2018.2.4 is loading the cloud-sdk appengine flexible environment classes instead of the standard environment classes.
A hacky way to overcome this is to open <path-to...>/googlecloudsdk/core/util/times.py in a text editor and comment out
from dateutil.tz import _common as tz_common
and
tz_common.PY3 = True # MONKEYPATCH!!! Fixes a Python 2 standard module bug.
Assuming you don't need this "monkeypatch", this solves the issue.
I installed version 211.0.0 -
https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-211.0.0-darwin-x86_64.tar.gz
Followed by:
gcloud components install app-engine-python
#user2061291's comments it's true. Pycharm is trying to run google-cloud-sdk/bin/dev_appserver.py. If you want to run app engine from pycharm anyway because you want to debug your code or something else then you should create a new python runner like this:
Script path:
/{YOUR GOOGLE-CLOUD-SDK ROOT
PATH}/google-cloud-sdk/platform/google_appengine/dev_appserver.py
For example:
trying to run a flask dev server on localhost:5000 using a virtualenv on Windows 7
In my command line in the project directory, i activated the virtualenv with the command "env\scripts\activate". It seemed to work, as my next line was preceded with an (env) tag. When I attempted to run the app file (bank_app), however, I got an import error.
Here's the console log
C:\Users\TJ\Documents\Python Projects\TestingPython> env\scripts\activate
(env) C:\Users\TJ\Documents\Python Projects\TestingPython> bank_app
Traceback (most recent call last):
File "C:\Users\TJ\Documents\Python Projects\TestingPython\bank_app.py", line 1, in <module>
from flask import Flask
ImportError: No module named flask
and here's a gist of the bank_app file (just in case it's relevant)
I'm used to running the code directly from PyCharm, which handles the virtualenv for me. it works fine running directly from PyCharm
This is probably related to how Windows maps extensions to executables.
You started the script with bank_app, which is really not the name of your script (your script has a .py extension I assume?). Windows must be doing a search in your directory, and then starting the script with the interpreter that is registered for the .py extension of the script, which is the globally installed interpreter, not the interpreter that is currently in the PATH.
I'm pretty sure if you run the command as python bank_app.py everything will work just fine.