How to create source type image in python code? - python-3.x

I am trying to create the source type image from python script in obs. Want to know proper steps to create source in script. I already checked, no proper doc for python scripting available.
obs.obs_source_create('banner-image','xyz')
obs.obs_source_create('banner-image','xyz')
Logs
TypeError: obs_source_create() takes exactly 4 arguments (2 given)
I want to create source type image from scrip & add that source to my current scene

This may be a simple FFI implementation, so try:
obs.obs_source_create('banner-image', 'xyz', None, None)
Source: First hit on Google when searching for "obs_source_create":
https://obsproject.com/docs/reference-sources.html
Excerpt:
obs_source_t *obs_source_create(const char *id, const char *name, obs_data_t *settings, obs_data_t *hotkey_data)
Creates a source of the specified type with the specified settings.
The “source” context is used for anything related to presenting or modifying video/audio. Use obs_source_release to release it.
Parameters:
id – The source type string identifier
name – The desired name of the source. If this is not unique, it will be made to be unique
settings – The settings for the source, or NULL if none
hotkey_data – Saved hotkey data for the source, or NULL if none
Returns:
A reference to the newly created source, or NULL if failed

Related

Filter on folder and item type in ArcGIS Online

enter image description hereI want to change the extent of all webmaps in a given folder in ArcGIS Online. However, the standard query command (gis.content.search) does not have a property that allows searching only in a folder.
On the other hand, once I have a list of all items in a given folder, I am unable to only filter all webmaps out. This is the script I used (see also the image):
folderowner = 'my_username'
updatefolder = 'testfolder'
user = gis.user.get(username=my_username)
user
rightFolder = user.items(folder = updatefolder)
rightFolder
for item in rightFolder:
print(item.type)
for item in rightFolder:
if (item_type = "Web Map"):
print (item.title)
screenshot of script
I can print the Item types. But once I try to list only Web Maps, I get a Syntax error. I have tried many different notations.
I can pass the types in a print command, but I can't use the types as a way to filter. Where I am basically looking for is thus a way to get only web maps in a given folder.

Azure Data Factory - Use system variable in Dynamic Content

I'm trying to use system variable '#pipeline().TriggerTime' in a dynamic content field.
I have a 'Copy Data' activity which has a sink dataset to a folder.
Inside this Sink dataset, I try to set the filepath to
#concat('Trigger_',formatDateTime(#pipeline().TriggerTime, 'ddMMyyyyHHmmss'), '.trg')
But I get the following error message.
The activity is contained in an 'If Condition' block which itself is contained in a 'ForEach' but this variable should be global in the pipeline so I don't see why it shouldn't work.
Thanks for any help.
As Joel comments,just change "#pipeline" to "pipeline".
#concat('Trigger_',formatDateTime(pipeline().TriggerTime, 'ddMMyyyyHHmmss'), '.trg')
If you want to use multiple functions,you just add # at the beginning.
If you want to get the string of functions,you need to add double #,such as "Answer is: ##{pipeline().parameters.myNumber}" return the string Answer is: #{pipeline().parameters.myNumber}.
More detail,you can refer to this documentation.

Multiple Keywords with same name found but there is only unique keyword

*When i run my robot tests it says Multiple keywords with name 'Set
Variable Value for' found. Give the full name of the keyword you want to use:
step_definitions.Set Variable Value for
variable_handler.Set Variable Value for
It does this for all the keywords mentioned in variable_handler.py
Is there something that i am missing? Do we need to give the name
of python file that has that keyword?*
found not much online. have added the library in the settings.
Variable_handler.py
```#keyword(name='Set Variable Value for')
def Set_Variable_Value_for(tag, value):
my_token_file = 'Resources/written_variables.yml'
data = None
with open(my_token_file, 'r') as testData:
data = yaml.load(testData)
data[tag] = value
with open(my_token_file, 'w') as writeTestData:
print(ruamel.yaml.dump(data, writeTestData,
Dumper=ruamel.yaml.RoundTripDumper))```
step_definitions.py
'''#keyword(name='Set Start Time for Test')
def Test_Start_Time():
tz = timezone('UTC')
Time_Now = datetime.now(tz)
naive_date = Time_Now.replace(tzinfo=None)
Set_Variable_Value_for('START_TIME', naive_date)```
Test.robot
'''Create a New Member
[Documentation] Add a New Member
[Tags] CreateMember MemberAndProjectCreationFlow SanityTest
All
Login to Platform Analytics
Verify Member List Page Elements
Click on Add Member
Add Member Breadcrumb is displayed
Add New Member Details
Verify New Member Creation
Search for the Member ${NEW_MEMBER_NAME_GLOBAL}
Search the Results and Go To ${NEW_MEMBER_NAME_GLOBAL}
${Member_Row_Locator} ${Member_Column}
${MEMBER_HOMEPAGE} = Replace String ${MEMBER_HOME}
MEMBERHOME ${NEW_MEMBER_SCHEMA_GLOBAL}
Set Global Variable ${MEMBER_HOMEPAGE_GLOBAL}
${MEMBER_HOMEPAGE}
🚩Set Variable Value for MEMBER_HOMEPAGE ${MEMBER_HOMEPAGE}
Log To Console Member Creation Successful.```
It should work without specifying the python file that contains
the key word. I have imported all the things required like variable_handler and step definitions
The root of the matter is that you have two or more keywords with the same name imported into the test. When you try to run the keyword Set Variable Value for, robot doesn't know which of the keywords to run. It has no way of knowing if the two names represent two different functions or the same function in two different libraries.
You have three possible solutions:
As the error suggests, you can specify the full path to the keyword, such as step_definitions.Set Variable Value
You tell robot to give precedence to one library over the other using the built-in keyword Set Library Search Order.
You can modify your libraries so that you don't have duplicate keyword names
For more information see Handling keywords with same names in the robot framework user guide.

Excel Import of custom mandatory field doesn't work [Hybris 6.7.0]

I'm using Hybris version 6.7.0 and I stuck with the following problem:
When I trying to perform importing products from excel file. It gives me the following error ->
I've checked the excel file and there is, of course, field "Subscription Term*", it is mandatory that's why there is an asterisk there. Good to mention that this field is custom, so I write custom translator to it and exporting part works fine, but in importing part when I did debugging I found strange fact:
This WorkbookMandatoryColumnsValidator validator calls the method findColumnIndex(typeSystemSheet, sheet, this.prepareSelectedAttribute(mandatoryField)); from DefaultExcelTemplateService this method returns -1 and the validation does not passed. I dig into this method and there is such line of code:
String attributeDisplayName = this.findAttributeDisplayNameInTypeSystemSheet(typeSystemSheet, selectedAttribute); which returns "Subscription Term" string as you can see without an asterisk.
I've checked the other mandatory fields e.g. "Catalog version*^" it returns with 2 symbols after it.
The thing is that "Subscription Term" and "Subscription Term*" after string equality operation returns false and the validation fails as you can see here:
attributeDisplayName.equals(this.getCellValue(headerRow.getCell(i))).
Of course the second value is taken from the excel file where the asterisk sign presents.
If I remove an asterisk from excel file then I receive: Unknown attributes of type ISku error in WorkbookTypeCodeAndSelectedAttributeValidator validator:
The asterisk should be presented in excel file, I've just checked what would be...
It doesn't help me at all to understand what really happens.
I can't understand one thing: What is the source of "Subscription Term" string? Why without an asterisk? Is it predefined constant somewhere?
From debug I couldn't figure out from which source that string comes from.
I do not know for sure but I expect that string( i.e Subscription Term) to come from a localization file based on backoffice current session language ( e.g {extensionName}-locales_en.properties if the current language is en).
Try to search after "Subscription Term" in all properties files.
Maybe, if the attribute is mandatory(i.e optional="false" in items.xml) then Hybris will add to its name an "*" when performing the import.
Check whether you provided read and write permission to that attribute for that user.
Check with admin user before doing that. If there is no issue with admin user, then only permission issue with the user.

How to use machine-generated variables in cookiecutter

Is there a way to machine-generate some values, after the user has supplied some their values for the variables in cookiecutter.json?
The reason I ask is that:
one of the values I need to prompt for is rather hard for users to work out
but it's really easy for me to write some Python code to generate the right value
So I'd really like to be able to remove the user prompt, and calculate the value instead.
Things I've tried:
Searched online for an example pre_gen_project.py file to show how to do it
Read the cookiecutter Advanced Usage page
I'm using cookiecutter on the command line:
cookiecutter path_to_template
Am I missing any tricks?
I needed this exact capability just a few days ago. The solution I came up with was to write a wrapper script for cookiecutter, similar to what is mentioned in:
http://cookiecutter.readthedocs.io/en/latest/advanced_usage.html#calling-cookiecutter-functions-from-python
My script generates a random string for use in a Django project. I called my script cut-cut:
#! /usr/bin/env python
from cookiecutter.main import cookiecutter
import os
rstring = ''.join([c for c in os.urandom(1024)
if c.isalnum()])[:64]
cookiecutter(
'django-template', # path/url to cookiecutter template
extra_context={'secret': rstring},
)
So now I simply run cut-cut and step through the process as normal. The only difference is that the entry named secret in my cookiecutter.json file is prepopulated with the generated value in rstring from the script, provided via the extra_context passed.
You could modify the script to accept the template via the command line, but in my usage I always use the same template, thus I simply pass a hard coded value "django-template" as noted in the code above.

Resources