I'm using googleads-python-lib and I want to do some budget-related operation with BudgetOrderService, but I cannot find it nether in documents nor googleads-python-lib.
How to use python to do some BudgetOrderService work?
Related
I have to fine-tune the OpenAI model on my custom dataset. I have created the dataset in jsonl format. I use the following commands on windows command line:
set OPENAI_API_KEY=<API key>
openai tools fine_tunes.prepare_data -f "train_data.jsonl"
The above commands run successfully and give me some suggestions for updating jsonl file. After this, I run the following command to fine-tune the 'curie' model.
openai api fine_tunes.create 'openai.api_key = <API key>' -t "train_data.jsonl" -m "curie"
But I am getting following issue:
←[91mError:←[0m Incorrect API key provided: "sk-iQJX*****************************************mux". You can find your API key at https://beta.openai.com. (HTTP status code: 401)
Can anybody help me out with this issue.
This is a common issue with an earlier version of the openai's CLI. If you haven't already, make sure you upgrade to the most recent version by doing
pip install --upgrade openai
One possible workaround is to just use a python script to do what you would normally do in the CLI.
# To train a model:
import os
import openai
os.environ["OPENAI_API_KEY"] = "sk-iQJX*****************************************mux"
os.system("openai api fine_tunes.create -t train_data.jsonl -m curie")
When assigning the API key in command line, dont use double quotes like:
API_KEY=ab-123123123123123231
This will solve the issue
I am trying to import modules into executescript processor in nifi.
As suggested , I. am giving full path into the modules directory.
example:
Module Directory: /var/lib/nifi/Levenshtein --> which contains necessary files for the script.
Furthermore, In the script also I have set the system path pointing to use that module directory
My code Looks something like this
import re
import datetime
import sys
sys.path.append('/var/lib/nifi/Levenshtein')
import Levenshtein
When I am running the processor with above code it fails.
ERROR: No Module named Levenshtein in at line number 3.
If this particular library is a "native module" (compiled C code), Jython (the Python execution engine used by ExecuteScript) will not be able to load it. ExecuteScript in NiFi using Python can only use pure Python code.
The work-around is to use ExecuteProcess or ExecuteStreamCommand and invoke python <my_script.py> on the command-line, which can handle various Python versions, native modules, etc. This execution will occur outside the JVM and use real Python, not Jython.
To sum up what Andy said, this Levensthein module is written in C and cannot be executed by a Java virtual machine, assuming you are running a Jython implementation.
Is there a package in Python3, which can check if a windows directory is shared? and also to share a windows directory?
I am aware of using 'net share' command, I would like to know if there are is a pythonic way of doing it
For check and add, you could use NetShareCheck and NetShareAdd.
And here is an sample to use netapi in python.
Or Use winapi SHGetFileInfo with SHGFI_ATTRIBUTES, then check the dwAttributes flag for SFGAO_SHARE.
You could create it with class Win32_Share and its Create method
import wmi
c = wmi.WMI()
c.Win32_Share().Create(args)
I want to be able to graph using Matplotlib in Jython so that I can use ABAGAIL inside of Python.
ABAGAIL:
https://github.com/pushkar/ABAGAIL
Jython does not seem to support Matplotlib. But I found the following idea on how to call Python inside of Jython:
Invoking Jython from Python (or Vice Versa)
Unfortunately, I can't get the code they suggest to work:
import execnet
gw = execnet.makegateway("popen//python=python")
channel = gw.remote_exec("""
from numpy import *
a = array([2,3,4])
channel.send(a.size)
""")
for item in channel:
print item
The main problem is that python=python doesn't work. What I'm not understanding is how to actually specify the version of python (anaconda, actually) on my Windows 10 system. What do I need to setup?
Also, is there an alternative package besides matplotlib I can use with Jython to create graphs?
I wrote a package that analyzes the structure of many yeoman generators:
https://github.com/tobiasoberrauch/yeoman-analyzer
Therefore I have to install all generators. This solution tooks very long (12 hours). I'm not quite sure is the current solution is the best way to do this:
Get the list of generator names: https://github.com/tobiasoberrauch/yeoman-analyzer/blob/master/lib/analyzer/data/generators.json
Install generators to node_modules regarding a list of generator names (VERY SLOW) : https://github.com/tobiasoberrauch/yeoman-analyzer/blob/master/lib/analyzer/generators.js#L24
Analyze the index.js from each generator: https://github.com/tobiasoberrauch/yeoman-analyzer/blob/master/lib/analyzer/generators.js#L47
Write report to a json file: https://github.com/tobiasoberrauch/yeoman-analyzer/blob/master/lib/analyzer/reporter/json.js#L21
Is there a way to speed up the process? 2. tooks very long.
I read about caching, local registry (npmd) but I didn't found a proper, fesiable solution.
I would be very happy about any hint :+1:
Cheers Tobias
If you need index.js only, you don't have to install all generators. Just download a tarball from npm registry using something like wget, and unpack it with tar xz.
Thanks for the hints.
Here's my (temporarily) solution:
Get package data from registry: https://github.com/tobiasoberrauch/yeoman-analyzer/blob/master/lib/analyzer/generators.js#L50
Get latest version: https://github.com/tobiasoberrauch/yeoman-analyzer/blob/master/lib/analyzer/generators.js#L64
Download and / or extract tarball file: https://github.com/tobiasoberrauch/yeoman-analyzer/blob/master/lib/analyzer/generators.js#L129
Read package.json from extracted file and get main file: https://github.com/tobiasoberrauch/yeoman-analyzer/blob/master/lib/analyzer/generators.js#L79
Find expressions in main file: https://github.com/tobiasoberrauch/yeoman-analyzer/blob/master/lib/analyzer/generators.js#L90
Sometimes is the zip file empty, the download stops suddenly or the esprima parser shows unexpected error. But I have a rough plan to optimize it.
This is just a awful callback hell. Now it's time to optimize and restructure.