setting custom viewerProcess fails - python

I am trying to set my viewerProcess option to be 'Show Primary Grade' instead of 'Film' whenever my nuke is booted
However, due to the limiting information I am able to find on the net, I tried inserting the following code nuke.knobDefault("viewerProcess", "Show Primary Grade") in the init.py but I am unable to get it covered, much less not knowing if the code I have written is right or wrong.
As the Show Primary Grade is a custom plugin that my workplace is using (it is shown in this naming in the list of selection), is there any ways to check and make sure that I am writing it right?
Oh and by the way, am I able to set its script Editor to be like Maya, where whenever the user clicks on something, it will display the results in the output field?

The correct command for setting a default Viewer Process is:
nuke.knobDefault('Viewer.viewerProcess', 'Show Primary Grade')
If that's not working, be sure the name you pass is exactly as registered. To check the registered names, run this command:
nuke.ViewerProcess.registeredNames()
Which by default returns:
['None', 'sRGB', 'rec709']

Turns out that I have to write out inside the menu.py file instead of init.py file.
And for some reasons, the naming convention - 'Show Primary Grade' works despite me unable to find the pass name for it even though I am able to track down its gizmo file...

Related

Pycharm database: trigger won't show up when I add it?

When I add a trigger using a SQL command run in Python, it executes, but the trigger won't show up in he Database pane of Pycharm? I've got my column folder, my key folder, my foreign keys, and my indices, but where are my triggers? I've already clicked 'Synchronize' and so on.
What's more, when I try to insert into my table, it complains the trigger is invalid! So these two things may be related? And why does it say the trigger is invalid, yet it doesn't show the trigger in the pane above? What can I do to fix it. The trigger is properly specified!

How can I iterate a list of users and create each user on a machine in Ansible?

I have a list of users from an external source and a remote machine. I want to take the list from the external source and compare it against my current machine's user list and create users for each user that does not exist on the machine.
I have tried this using ansible runner (pseudo-code below):
for user in users:
updateUsers(user)
which will call an Ansible.runner object and make the following call:
ansible.runner.Runner(
pattern='tools',
forks=10,
module_name='user',
module_args="",
complex_args=OrderedDict(sorted(dict(name=name, group=group, state=state).items())),
sudo=True,
).run()
For now group and state are defined globally.
My issue is that as this traverses the for-loop, it does indeed create users as I have specified it to do so; the main issue is that it creates users and then the permissions on the home directories of each respective user do not allow the user access to it. So say "joeshmo" was a user: he would not be able to write to his own ~/ dir.
I am looking for some guidance on how I'm doing this.
Is there a way with playbook to dynamically iterate through a file and grab different user names to add them as users to the system without the permission errors?
Is there a way to fix my current script to not have these errors?
Thank you
If you really need to use code to get your users list, you can write your own iterators in python and put them in a lookup_plugins dir next to your playbook. Then you can do this:
# Use my custom users.py lookup plugin
- user: name={{item.name}} group={{item.group}} state=present
with_users:
Here's how I'd do it.
Create a custom facts script to get all your user/group info from the machine during fact gathering. This file can be any shell executable that output valid JSON
Compare the list of fact gathered users/groups with your external source (not sure what format you have it stored in) and add/delete users appropriately.
I know there is a bit of overhead with creating, deploying and managing an additional script for custom facts but I think it's worth it. I've attempted to gather all sorts of information using just playbook and it can get really ugly and you'll end up writing all sorts of filter plugins, curse the set_fact module and end up with a 200 line playbook.

Automatically update database in django

I am trying to build a website that displays stock information and I have a file called populate_stocks.py that populates the database with a given set of stocks. Since these stocks change almost every minute, I need to make sure I update the database with new information by running populate_stocks.py again.
I was wondering if there is any way to let my django application automatically call this file to update the stock information. I searched around and found another person using crontab which seems a bit complicated and was wondering if there is another solution.
Though I agree that the use of crontab to solve this problem is actually probably the easiest solution to this problem, there is a possible alternative over crontab which would be to make a management function that runs alongside your server.
Basically in its absolute simplest form you would make a basic loop in the form of a Django NoArgsCommand.
from django.core.management.base import NoArgsCommand
from populate_stocks import yourmysticalfunctionofupdating
class Command(NoArgsCommand):
help = "This runs the loop of glory, that does as it is told."
def handle_noargs(self, **options):
while True:
yourmysticalfunctionofupdating()
You would need to put this into a management -> commands folder and name the python file whatever you want the command should be (imagine it is updatify.py in this example).
You could then run the following command to run your watchdog.
./manage.py updatify
Though this may be overkill for your particular problem I have found it very helpful for trickier issues, and I hope it saves someone some time.

Query regarding data entry form

I am curious about something I encountered when I was registering on the wakari website. I entered my username which was something like abc.def.ghi and all other information and submitted the form ( or at least tried to submit! ). It threw up an error which said "username must be a valid python variable", so they were obviously doing something in their back-end with usernames as python variables. Would anyone explain to me if this is some sort of design scheme that they are using wherein they store user information as python variables or something like that. Again I apologize since this is not really a specific programming question but this is eating me up and I must know why that happened.
The following is the URL:
https://www.wakari.io/usermgmt/loginorregister
This is pure conjecture. One thing I could see wakiri doing is using the usernames as a module name for your code. That might be interesting. So storing user code as wakiri.<username>. Then the application might be doing an import wakiri.<username> with some interesting stuff in the __init__.py that runs whatever it finds.
Maybe that's it. Or maybe they are storing user code in files on disk. Maybe user code is written out to a file that contains lots of dictionaries that contain code and are named after the username?
Maybe they aren't even using it and just think it is cute to restrict people to valid Python variables.
I'm a Wakari developer, and we've only just caught this question. The short version is that you are pretty safe with a valid UNIX username, and the "error" text should say something using better "plain english" to this effect.
The reason we say the username needs to be a valid Python module name is that we're imagining a day when users could have something like ~/public_python as a place to put directly-shareable code, and then other users could access this via something like from wakari.users import steve. We'd leave it up to you to figure out if you trust user steve enough to import his code directly.

Warning while saving opportunity in OpenERP

After creating an opportunity, when I click on save, it gives me this warning for some users:
"Operation prohibited by access rules, or performed on an already deleted document (Operation: read, Document type: User Modification)."
What's causing this problem?
Update: I have created a new user of admin type and I added these groups:
Sales/User,Sales/User All Leads,Survey/User,Tools/User. It gives me a warning while creating an opportunity.
I added the following groups to the new user and it's working fine: Employee, PartnerManager, Marketing/User, Accounting/Accountant, Accounting/Invoice, Accounting/Manager, Administration/Access Rights, Human Resource/Manager, Human Resource/User, Knowledge/User, Marketing/Manager, Project/Manager, Sales/Manager, Tools/Manager, trimax/AdminMeeting, Trimax/‌​SalesExecutive, Trimax/Vertical, Trimax/SalesHead, Trimax/SalesManager, Useability/An‌alyticAccounting, Useability/Extended, View, Useability/MultiCompanies, Useability/No One, Useability/Product Uos View, Useability/Product Variant, Warehouse/Manager, Warehouse/User, Tools/User, Administration/Configuration
But in already created user if I remove the above groups which give warning ,then also it shows same warning.
The solution I mentioned above was for new users,but for some existing users it was still giving problem. So I removed some unwanted groups, which I didn't needed for those users and it worked, now it does not show warning. Was the warning due to some access right overlap or something else?
Those users probably don't have access rights for the opportunity object, or some child object. Read the access rights documentation for more details.
Update: You said that you're having trouble configuring a new user. As an experiment, try adding permissions to an existing user instead of starting a brand new user. Also, check that you've configured the roles as well as the permissions, that trips me up sometimes.
Another Update: You said that removing some groups stopped the warning. It may be that you have removed all access rules from the object. If no groups are explicitly granted access to something in OpenERP, then everyone is granted access. If you really want to figure out what's going on, I suggest you read the documentation I linked to above. You can also search for the error message in the source code and see exactly what it is complaining about. I find it really helpful to run the OpenERP server in debug mode, and step through the code when I'm trying to understand some weird behaviour like this. You can also try and figure out exactly which change triggers this error by adding and removing groups until you find a single change that makes the problem happen.
Hi these is due to the access right problem .So you give the proper access right to your user(for creating the oppurtunity)
same problem here.I'm using Multi-company, I provid all permistion to the user

Categories

Resources