简体   繁体   English

尝试从命令行执行脚本时出现Python语法错误

[英]Python syntax error when trying to execute a script from command line

I've never used python before, but I have to in order to enable push notifications on my android app. 我以前从未使用过python,但必须这样做才能在我的android应用程序上启用推送通知。 When I type 当我打字

python D:\Project\UAirship\clientauth.py

I get a syntax error with an error pointing to the drive letter. 我收到语法错误,并指向驱动器号的错误。 I've read support articles on urban airships website, and this is the way they execute this script so I'm not sure what I'm doing wrong. 我已经阅读了城市飞艇网站上的支持文章,这是他们执行此脚本的方式,因此我不确定自己做错了什么。 Thanks for your help. 谢谢你的帮助。

您应该在shell /命令解释器中输入该名称,而不是在Python REPL中输入。

  1. Check to make sure you've added Python to your path. 检查并确保已将Python添加到路径中。 At the C:> prompt type 在C:>提示符下键入

    python

    and see what happens. 看看会发生什么。 If you get the Python shell, great. 如果您拥有Python Shell,那就太好了。 Else do what the faq says. 否则,您会按常见问题说的去做。

  2. edit : just fired up a windows box to check, and the D: shouldn't be a problem, never mind the thought that was previously occupying this space. 编辑 :只是打开了一个Windows框进行检查,而D:应该不是问题,不要介意以前占据这个空间的想法。

  3. It seems likely that ignacio is right in his answer: you're typing a command-prompt command into the python shell. ignacio的答案似乎很正确:您正在python shell中键入命令提示符命令。 Your cursor should be flashing after something that looks like this 看起来像这样的光标应该在闪烁

    C:\\>

    if it looks like this 如果看起来像这样

    >>>

    type exit() to get out of the python shell and try again. 键入exit() python shell,然后重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试在 Android 活动中执行简单命令时出错 - Error when trying to execute a simple command in Android activity 尝试从命令行向ionic添加android平台时在module.js:341发生错误 - Error at module.js:341 when trying to add android platform to ionic from command line 如果在脚本输出中找到新行,则执行命令 - Execute a command if new line is found in script output 使用Shell脚本从命令行启动Android仿真器后,如何执行下一个命令? - How to execute next command after Launch Android emulator from command line using shell script? 尝试使用su执行命令时出现SyncFailedException - SyncFailedException when trying to execute a command using su Android SQLLite,尝试从数据库获取数据时出现语法错误 - Android SQLLite, Syntax error when trying to get data from database 当我尝试在Android Shell上运行bash脚本时,出现语法错误 - When I am trying to run bash script on android shell I am getting syntax error 尝试从资产读取转储文件时出现断线的SQLiteException语法错误 - SQLiteException syntax error on line breaks trying to read dump file from assets Python telnet可在命令行中运行,但不能在脚本中运行 - Python telnet works in command line but not in script 尝试更新行时出现SQLite语法错误 - SQLite syntax error when trying to update row
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM