You see I am making a python gui with pysimplegui for my old qrcode generator script so im using shutils for the user to download the file.
I am using the 'default' thing because i want it to save to my users path not mine, do you know some other way I can do that? because i think this is the reason its not working
I tried making it so the user inputs there username such as 'My laptop' so it adds it to the path
src_path = r"D:\Python\QRcode generator\output.png"
dst_path = r"C:\Users\Default\Pictures"
shutil.move(src_path, dst_path)
The code is correct. It wont give any error if you dont use C drive (Where the operating system is installed)
This is mostly due to C drive is protected for windows stability.
If you are using any code editor (Pycharm, VS Code etc.) or running the code in windows command prompt or any terminal etc. Try and run it with administrator rights
It should work.
Related
I am trying to develop my own GtkPrintBackend ,
taking help from here:
https://mail.gnome.org/archives/desktop-devel-list/2006-December/msg00069.html
I want to test my print backend( by making the print dialog use my backend instead). How do I do that?
That is, how do I make the Print dialog use my backend instead?
Answering my own question here since I figured out a workaround:
I installed jhbuild and built the gtk+ module using jhbuild.
The source code of the corresponding module is downloaded in ~/jhbuild/checkout/<module-name> .
Modify the print backends under ~jhbuild/checkout/gtk+/gtk/modules/printbackends/ directory, and rebuild it (Find instructions to do that here).
Now when you launch a gtk application from the jhbuild shell, it will use the modified backend instead of the system default one.
I am using this to map a drive letter in PowerShell v2, and it works in that the drive letter shows up and is usable in Explorer.
$Network = New-Object -ComObject "Wscript.Network"
$Network.MapNetworkDrive($drive.name, $drive.value, $true)
However, if I then try to use that drive letter to do anything in Powershell, say to create a folder, I get a DriveNotFoundException. But as I said, the drive is there and usable manually. I thought I might need to wait for a bit, or refresh Explorer, or both, but doing so seems not to affect anything. However, if I turn around and rerun the script, which checks in advance to see if the drive is there, and only creates it if not, it will see the drive and not recreate, and a following task will work fine. As if perhaps the drive letter is session based?
I also tried adding
New-PSDrive -name:($drive.name -replace ':', '') -psProvider:FileSystem -root:$drive.value -scope:Global
as well, in the hopes that this would provide a session based drive, but no good.
An additional wrinkle is that the script has to be Run as Administrator, but again, if I do it as two different scripts, one to create the drive and one to use it, it works when both are Run As Administrator. It's only when both tasks are done in the one script that it fails.
One last point, I know PS 3 has a better way to handle mapped drives, but due to things beyond my control I am limited to PS v2.
I don't think what you want is possible in PowerShell v2. To have New-PSDrive create a Windows drive you need to add the parameter -Persist, which isn't available in PowerShell v2.
From the documentation:
-Persist
Creates a Windows mapped network drive. Mapped network drives are saved in Windows on the local computer. They are persistent, not session-specific, and can be viewed and managed in File Explorer and other tools.
I'd say your best option (aside from upgrading to PowerShell v3 or newer) is to use the net command:
& net use $drive.name $drive.value /persistent:yes
I am trying to get rails to select document attachments, then kick off the email client with the documents attached.
I have it working on my development laptop. If I build a string with the appropriate parameters and pass that to system() then it kicks off the email client with the attachments..
The string looks something like
#email_content = "C:\Program Files (x86)\IBM\Lotus\Notes\notes.exe"
"Mailto:?Attach=C:\Users\cm\RubymineProjects\technical_library\public\images\1\8302_printed.pdf
The first part calls the notes exe and the second part starts and email with the attachments. That worked fine on my laptop.
However, when I moved it to the server, it isn't kicking off the email client. I believe that it is because the shell commands are trying to execute on the server, not on the client.
Is it possible to run a shell command on the client machine? I am trying to get this working with Windows first and then the Mac environmemnt. I tried changing the C:\ to the machine name. i.e. \chrislaptop\Program Files (x86)\IBM\Lotus\Notes\notes.exe. but that didn't work.
No, fortunately that is not possible.
Imagine what happens when a request to some random page on the internet could trigger shell scripts on your local computer...
Arbitrary code execution escaping the browser is too invasive-- your app should not have access to the client's machine.
However, some applications may support URIs that open specific applications outside the browser. You generally see this more on mobile devices, but Spotify for example supports links that look like: spotify:artist:5lsC3H1vh9YSRQckyGv0Up which asks the user whether it is ok to open the Spotify application.
https://news.spotify.com/us/2008/01/14/linking-to-spotify/
How do I get a folder to appear in the browser after adding it to \pentaho-solutions in Pentaho 5.0.1 CE. The documentation I read does not seem to work with this new version.
1. Create a new directory in /pentaho/server/biserver-ee/pentaho-solutions/.
Use underscores instead of spaces in the solution directory name. Ensure that the directory has the appropriate user
and group ownership to be writable from the BI Platform.
2. Using an XML-aware text editor (or Design Studio), create a file named index.xmlin your new solution directory.
3. Copy the following text into the index.xml file, changing the content accordingly:
***<index>
<name>Example Solution</name>
<description>This solution contains examples I created while learning to
work with action sequences.</description>
<icon></icon>
<visible>true</visible>
<display-type>icons</display-type>
</index>***
4. Save the file and close the text editor.
5. Log into the Pentaho User Console as an administrator.
6. Refresh the solution repository cache by going to the Toolsmenu, then selecting the Refreshsubmenu, then
clicking on Repository Cache.
You now have a new solution directory. It will show up in all file dialogues in the Pentaho User Console as well as the
Solution Browser in the left pane.
Every time you add or edit an action sequence to your solution directory, you must refresh the repository cache as
explained above. Each user currently logged into the Pentaho User Console must also refresh their session cache; this
is best done by re-logging into the Pentaho User Console.
I am using Pentaho design studio to develop an xaction sequence script. I followed this procedure:
1. In Design Studio, go to the Filemenu, then select New, and click on Other...in the sub-menu.
The Newwindow will appear.
2. In the Newwindow, click the triangle next to Pentaho, select New Action Sequence Wizard, then click Next.
3. In the File namefield, type hello_world.xaction.
4. Select Hello Worldfrom the Templatedrop-down box, then click Finish.
The wizard will generate the new file and bring you back to the workbench.
5. Click on HelloWorldComponentin the Process Actionssection on the left.
The right side of the screen will change to show the options available for this action: Nameand Message. The
Name field controls the name of the component in the Process Actions list on the left; it doesn't do anything else of
note. The Message field contains the text that will appear on the screen when the action sequence is run. It is prepopulated with %quote, which is a token that represents a quote message in a nonexistent properties file. Pentaho
used to provide properties files for each example, but they have been removed from the standard Pentaho Business
Analytics distribution.
6. Replace the %quotewith a sufficiently inspiring message.
Alternatively, you could create a hello_world.propertiesfile and populate it with the appropriate messages and
tokens, but that has no advantage unless you intend to internationalize this action sequence.
7. Save the file.
You now have a working action sequence that prints a short text message: "Hello, World." plus whatever you typed into
the Message field. The first part of the message is determined by a message bundle packaged with the Pentaho Web
application archive.
To test the action sequence, use the Test tab if you are on Windows or OS X, or log into the Pentaho User Console and
run it from the Solution Browser.
Running the sample xaction fails with
Sorry. We really did try.
Something went wrong. Please try again
or contact your administrator.
I figure this is because pentaho cannot locate the xaction file as specified in the file path when I generate the url from within design studio. The folder I created within the solution directory does not appear in the browser directory list despite refreshing the cache. Any help?
With Version 5 the files and folders are no longer stored in "/pentaho/server/biserver-ee/pentaho-solutions/..."
It is stored now in a jackrabbit repository.
You can create folders and upload files in the user console.
I did mistake after starting biserver 5.2. Unexpectedly i deleted Public folder after configuring to jackrabbit. Now how do i create the folder so that i can see Public and Home Folders.
Sorry for getting back to this question some time later, just in case someone searches something related to Pentaho repositories management with no success, i hope this information can help.
Just to make things more clear, i'm using version 5.2.x and i'm supposing you want to create a new folder on the root directory of Browse Files screen, something that is not allowed on Pentaho5 CE Web Console.
The answers about repository management based on JackRabbit are correct, so the old way we used to configure new "solutions" folders doesn't work anymore. From version 5 on, Pentaho exposes an interesting REST api that allows you doing things not allowed in web console.
For instance, for creating a folder in root directory you should create a http REST PUT request against Pentaho Server (using tools like curl or if you appreciate Google Chrome, something like Advanced Rest Client, etc.) using the following URL:
http://localhost:8080/pentaho/api/repo/dirs/:new_directory_name?userid=admin&password=password
Pentaho repository directory REST api is documented here:
http://javadoc.pentaho.com/bi-platform500/webservice500/resource_DirectoryResource.html
It's worthy to spend some time reading REST API the documentation.
I am writing an app in VB.NET (Visual Studio 2013) and as a final step, it has two copy a folder (with several files inside) into a certain directory in an iPhone.
The iPhone is jailbroken so it is possible to access every kind of directory and it should also be connected to the PC via USB. Is this even possible?
Thank you in advance!
I suck at visual basic, but I can tell you how you would do this programmatically:
First, you need to tunnel SSH over USB. You can do that by programatically executing itunnel_mux.exe from this zip.(you'll have to extract everything first.) Use it like this:
itunnel_mux.exe --tunnel -iport 22 -lport 2222
Then, you can use SCP (I'd recommend this library) to Copy files over from root#127.0.0.1:2222 (password alpine).
This is some example pseudocode (keep in mind, I don't know VB):
'Extract the exe and dll file from that zip
extract_files()
'I'm making a new variable containing the port number.
Dim port As string = "2222"
'I made up this function. Lets pretend it executes Batch code in the current directory (like a bat file)
execbat("itunnel_mux.exe --tunnel -iport 22 -lport " + port)
Using scp As New Rebex.Net.Scp
' connect to a server
scp.Connect(hostname)
' authenticate (change alpine if you changed your root passwd)
scp.Login("root", "alpine")
' Here, you can use "scp" to upload and download files
scp.PutFile("C:\Users\KevinKZ\Desktop\fileToUpload.jpg", "/var/mobile/Documents/fileToUpload.jpg")
scp.GetFile("/var/mobile/Library/SMS/sms.db", "C:\Users\KevinKZ\Desktop\SMS_Backups\2-1-14.db")
scp.Disconnect()
End Using
This solution is far from elegant. It also requires OpenSSH (I think). If you want something easier and/or more flexible, let me know. You might be better off using libimobiledevice. If you still need help let me know. You can email me at alex#alexhulbert.com
If the directory is accessible from Windows then yes.