Send a file on a samba share from python script [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I've a samba share on my NAS, which is accessible in R/W as guest.
From a python script on my raspberry, I would like to send some file.
I've made the following script:
from shutil import copyfile
copyfile('/home/pi/Test/README.md', r'\\192.168.0.30\Public\test')
I've no errors, but the file is not send to my NAS.
any idea what I'm doing wrong?

I ended by creating a network share:
import subprocess
remoteHost="192.168.0.30"
remoteShare="Public"
remoteSubFolder="test"
remoteUser='picam'
remotePassword='picam'
localMountPoint = '/mnt/remoteServer'
destinationFolder = localMountPoint+'/'+remoteSubFolder
if not os.path.exists(localMountPoint):
os.makedirs(localMountPoint)
command = "sudo mount -t cifs -o username="+remoteUser+",password="+remotePassword+" //"+remoteHost+"/"+remoteShare+" "+localMountPoint
logMsg("Executing mounting command: "+command)
subprocess.Popen(command, shell=True)
And now the copy work. Not really what I was hopping but at least it works.

Related

LP on Mac prints WAYY too big [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 months ago.
Improve this question
The issue
when using the ls command on mac via python os.system(), the printed content is much too large.
AKA, the entire PDF file I am trying to print(visible here) cannot be seen, and only the bottom half of the bottom left section of 9 can be seen.
What I have tried
I have not tried much, since I could not find many resources on this topic online, but, I have attempted to print it with Preview to determine if it was a problem with the actual PDF, and the result was flawless, so, I copied the scale from Preview into the lp command, to result in the final command:
ls -o scaling=32 soduko.pdf
Any Help would be greatly appreciated!
Note: Whatever I try will be printed in real life, and costs money and ink, therefore, the best solution would be the one without any brute force or several tries.
Adding the -o fit-to-page argument has fixed my answer. Thank you for the help! The final command was:
lp -o fit-to-page soduko.pdf

Expose local server python? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 12 months ago.
Improve this question
I have a two socket scripts which I want to access from outside local network but None of these solution seem to work.Tried this Accessing python server (web server) using ngrok and this https://pyngrok.readthedocs.io/en/latest/integrations.html#python-tcp-server-and-client and this https://gist.github.com/Jc2k/61aeb5b551d006b17f97 didn't work for me.
Windows 7 python 3.8.8
Any other solution?
This solution may work it worked for me
https://youtu.be/HI1kbr6vBhQ
Just follow the screen as the voice is in another language.
First setup ngrok
Then ngrok tcp port-no
It will return 'forwarding' which will have a port number put it in your file
Then ping the thing it returned it will return the ip then put it in client file
That's all

pysc2 Starcraft - obs.observation returns KeyError [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 4 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I am trying to run various codes I found in the internet with pysc2 Starcraft DeepMind AI agents. I often run into KeyError: 'SOME-VALUE-HERE' invoked by obs.observation["SOME-VALUE-HERE"].
For example this agent and this agent crash on KeyError: 'minimap' invoked by obs.observation['minimap'].
Other example is KeyError: 'screen' invoked by observation["screen"] when running Siraj Raval's enjoy_mineral_shards script.
It is very frustrating as I have not found anybody else running to this error and I really struggle with debugging in pysc2 environment. Any help?
The codes were run with pysc2 version 2.0.1. One needs to downgrade to version 1.2 (relevant for mentioned examples).
pip install pysc2==1.2
(many thanks to discordapp Starcraft 2 AI community).

iPython notebook not loading [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
So my iPython notebook comes up in my browser (chrome) and when I open my specific notebook a new tab opens. However the work does not load up! The page also freezes. Is this an iPython issue or something wrong with the file? Was working yesterday. I've restared comp etc. but no luck
Update: just tried renaming notebook to open again with no luck
Update 2: One has now shown up - but can't do anything with it! Is iPython simply extremely extremely slow...
Is it possible that one of the cells got a lot of output data?
if so,
try editing the file manually (with notepad++ or something like this), and delete cell's output

traceroute syntax error in python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am new to python and am now learning about 'traceroute'. I don't exactly understand how this works. If I am typing the traceroute in python command line, I receive a syntax error:
traceroute www.somewebsite.com
I receive a syntax error pointing to ^www
Am I misunderstanding or doing something wrong? I'm trying to work on this in practice from a book reading assignment.
Can someone explain what traceroute is exactly?
Your help is appreciated, thank you.
This is not supposed to work, because python does not understand terminal/cmd commands. So you need to use os.system in this case:
So, in your case:
import os
os.system('traceroute www.somewebsite.com`)
In windows its tracert not traceroute.

Categories

Resources