openatx / adbutils

pure python adb library for google adb service.
MIT License
736 stars 173 forks source link

Error while pushing file to phone. #68

Closed MilkFlavor closed 2 years ago

MilkFlavor commented 2 years ago

So I was using Adbutils. However, I face an error while pushing a file onto an android:

OSError: [Errno subprocess] 'C:\Users\shiba\AppData\Local\Programs\Python\Python310\lib\site-packages\adbutils\binaries\adb.exe' -s N9XDU17207002827 push 'c:\Users\shiba\Documents\Mirror\src\scrcpy\scrcpy-server-v1.24.jar' /data/local/tmp/: 'The filename, directory name, or volume label syntax is incorrect.\r\n'

I first thought the files were just not there, but I'm fairly confident that the file exists. Here is the code I'm running:

jar_name = "scrcpy-server-v1.24.jar"
        server_file_path = os.path.join(
            os.path.abspath(os.path.dirname(__file__)), jar_name
        )
        self.device.push(server_file_path, "/data/local/tmp/")
MilkFlavor commented 2 years ago

Full code: https://pastebin.com/R0xjsv7V

MilkFlavor commented 2 years ago

If it helps I ran the command regularly and it worked:

PS C:\Users\shiba\Documents\Mirror> C:\Users\shiba\AppData\Local\Programs\Python\Python310\lib\site-packages\adbutils\binaries\adb.exe -s N9XDU17207002827 push c:\Users\shiba\Documents\Mirror\src\scrcpy\scrcpy-server-v1.24.jar /data/local/tmp/   
c:\Users\shiba\Documents\Mirror\src\scrcpy\sc..., 0 skipped. 0.7 MB/s (41159 bytes in 0.056s)
MilkFlavor commented 2 years ago

I did a bit more testing and it's probably a windows issue.

codeskyblue commented 2 years ago

the adbutils.push is not very smart, you should use fullpath instead of direction for the second argument.

Usage example:

device.push("scrcpy.jar", "/data/local/tmp/scrcpy.jar")
MilkFlavor commented 2 years ago

Thanks that worked!

codeskyblue commented 2 years ago

@MilkFlavor I checked your code, https://pastebin.com/R0xjsv7V Use pyav to parse scrcpy h264 stream something got wrong. Maybe scrcpy is not the standard h264 stream