pycharm

How To Get Rid Of “Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)” in Pychar+Django

随声附和 提交于 2021-02-11 15:29:54
问题 When I run my test suite using pycharm for a django app in my local machine, at certain test I got: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) If I run that test in isolation using pycharm, it succeeds, which means there's not a problem in the app or test. If I disable that particular test, down the line I get the same error, in a different test, this one a dummy test! This seems to indicate that it's a problem with pycharm itself. The full test suite succeeds in

TypeError: not all arguments converted during string formatting in psycopg2

十年热恋 提交于 2021-02-11 14:34:54
问题 When I run the below code with psycopg2: cur.execute( """INSERT INTO logmsg (msg_type, file, msg) VALUES %s;""", ["Error", str(file), str(sys.exc_info()[0])]) I get the following error: TypeError: not all arguments converted during string formatting Can someone help me with this? 回答1: VALUES needs a list of values enclosed in brackets: cur.execute( """INSERT INTO logmsg (msg_type, file, msg) VALUES (%s, %s, %s);""", ["Error", str(file), str(sys.exc_info()[0])]) Do not forget to commit the

Tensorflow : ImportError: DLL load failed

我们两清 提交于 2021-02-11 13:55:26
问题 I am using Windows 10, Python 3.7.8 and PyCharm. First, I installed Python 3.7.8. Then I installed PyCharm. I am trying to run Python code, to be specific Tensorflow code. I follow these instructions here: https://www.tensorflow.org/site-assets/downloads/marketing/cert/Setting_Up_TF_Developer_Certificate_Exam.pdf Page 4-8. As in the instructions I create a new PyCharm project: Then in the preferences for this Project, choosing Python Interpreter I install the following packages: tensorflow

How to set default python interpreter in pycharm

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-11 09:41:06
问题 Every-time i start Pycharm i need to tell it what is my default interpreter. But it forgets and asks against after restarting the program. Is there anyway i can set it so that PyCharm would remember what my default interpreters was so I don't need to specify it when i restart the software? 回答1: Here you can set it. Here you can set interpreter for every upcoming project. In previous versions it was like. File->Default Settings 来源: https://stackoverflow.com/questions/58767672/how-to-set

ImportError in the console, but import is working in PyCharm

陌路散爱 提交于 2021-02-11 07:44:47
问题 I have a programm which imports the request module like this: import urllib from urllib import request ... The programm is running fine in the PyCharm-IDE. But when I run the same code in the console in Linux Ubuntu I get the error: ImportError: cannot import name request Is there a problem with my path? Should I provide more information to solve this problem? According to ImportError on console but not in PyCharm PyCharm is setting the working directory. But when I add this working directory

pycharm terminal and run giving different results

核能气质少年 提交于 2021-02-11 07:34:53
问题 Using Pycharm to write a python script for loading and formatting a fixed width file I'm getting different results when I run the script in terminal (within Pycharm or locally) and when using the run option in Pycharm. Any reason why this is the case and which is correct? with open('uk_dcl_mrg.txt', 'rb') as f: ct = 0 for line in f: ct += 1 #### OUTOUT #### for i in layout: ## Loop to create dictionary headerdict[i[0]] = line[i[1]:i[2]] if (headerdict['CORP-STATUS-IND'] == "\x9f"): headerdict

pycharm terminal and run giving different results

家住魔仙堡 提交于 2021-02-11 07:33:27
问题 Using Pycharm to write a python script for loading and formatting a fixed width file I'm getting different results when I run the script in terminal (within Pycharm or locally) and when using the run option in Pycharm. Any reason why this is the case and which is correct? with open('uk_dcl_mrg.txt', 'rb') as f: ct = 0 for line in f: ct += 1 #### OUTOUT #### for i in layout: ## Loop to create dictionary headerdict[i[0]] = line[i[1]:i[2]] if (headerdict['CORP-STATUS-IND'] == "\x9f"): headerdict

Workable alternative to “Presentation Mode” in Intellij and Pycharm

流过昼夜 提交于 2021-02-10 18:28:25
问题 As detailed in this YouTrack issue https://youtrack.jetbrains.com/issue/PY-40008 Presentation Mode is basically a one-way ticket: you can check in but you just can't leave . One of the "misses" of returning to "normal" mode is that only the Editor panel is displayed: the Explorer, Debugger, etc. are all invisible. That's a hassle to rectify in real time when presenting to a group of people. When I am actually giving presentations that include code snippet walk-throughs going back and forth

手把手教你用Python实现批量文件的压缩处理

让人想犯罪 __ 提交于 2021-02-10 09:59:16
点击上方“ Python爬虫与数据挖掘 ”,进行关注 回复“ 书籍 ”即可获赠Python从入门到进阶共10本电子书 今 日 鸡 汤 近乡情更怯,不敢问来人。 一、前言 大家好,我是崔艳飞。接到项目求助,需要对上千个文件夹中的文件进行压缩处理,并要删除源文件,只保留压缩后的压缩文件,数据量大,手动完成耗时耗力,用Python处理再合适不过了。 二、项目目标 批量对文件夹的内容进行压缩处理,满足客户要求。 三、项目准备 软件:PyCharm 需要的库:os, shutil,zipfile 四、项目分析 1)如何读取源文件? 利用OS库,获取文件夹名list,利用for循环,轻松拿到要压缩的源文件。 2)如何进行压缩处理? 利用zipfile库中的zipfile.ZipFile()对获取到的文件进行压缩处理。 3)如何删除源文件? 先利用os库的remove()删除文件,再利用shutil库的rmtree()删除空文件夹。 五、项目实现 1、第一步导入需要的三个库 import os as os import shutil import zipfile 2、第二步定义删除文件函数和压缩文件函数 def del_ (rootdir) : filelist = [] filelist = os.listdir(rootdir) # 列出该目录下的所有文件名 for f in

How to move caret to console in pycharm?

那年仲夏 提交于 2021-02-10 06:48:55
问题 Is it possible to have a keyboard shortcut to move the caret from editor to console and back in pycharm? I can switch the focus between editor and console using CTRL+TAB, but that doesn't allow me to start typing in the console unless I click in it. I am using the linux community distribution. 回答1: I'm on MacOS and PyCharm 2018.2. Doing Ctrl+Tab+P opens up console and focuses on it so I can immediately start typing. Update: You can also set your own key map: Tool Windows/Python Console .