python-3.4

Reload a Module in Python 3.4 [duplicate]

给你一囗甜甜゛ 提交于 2019-11-30 13:43:11
问题 This question already has an answer here : Python3 - reload() can not be called on __import__ object? (1 answer) Closed 4 years ago . I know this might sound like a really stupid question but whatever. I've made a small script in Python and I've made some changes while in a shell. Normally, on an OS X computer (It's running Python 2.7), I would simply type in reload(the_module) and it would reload my module that includes the changes that I have made. However, when I am reloading the module

Using PythonService.exe to host python service while using virtualenv

不问归期 提交于 2019-11-30 13:10:19
I've got a Windows 7 environment where I need to develop a Python Windows Service using Python 3.4. I'm using pywin32's win32service module to setup the service and most of the hooks seem to be working ok. The problem is when I attempt to run the service from source code (using python service.py install followed by python service.py start ). This uses PythonService.exe to host service.py - but I'm using a venv virtual environment and the script can't find it's modules (error message discovered with python service.py debug ). Pywin32 is installed in the virtualenv and in looking at the source

Pandas error - invalid value encountered

坚强是说给别人听的谎言 提交于 2019-11-30 11:58:50
问题 I'm new to Pandas. I downloaded and installed Anaconda. Then I tried running the following code via the Spyder app: import pandas as pd import numpy as np train = pd.read_csv('/Users/Ben/Documents/Kaggle/Titanic/train.csv') train Although this prints the dataframe as I expected, it also shows these errors //anaconda/lib/python3.4/site-packages/pandas/core/format.py:1969: RuntimeWarning: invalid value encountered in greater has_large_values = (abs_vals > 1e8).any() //anaconda/lib/python3.4

Why 'python3 -m venv myenv' installs older version of pip into myenv than any version of pip I can find anywhere on the system?

我的未来我决定 提交于 2019-11-30 09:10:22
问题 This is not causing me any problem that I can't solve by activating the virtual environment and running pip install -U pip , but I always wonder where the older version of pip is coming from. I'm using OS X 10.7.5. When I create a virtual environment using either pyvenv-3.4 myenv or python3 -m venv myenv , the version of pip that is installed inside the virtual environment is 6.0.8, but I have upgraded my global pip to 6.1.1. Here is a terminal session demonstrating what I mean: $ python3 -m

PermissionError [errno 13] when running openpyxl python script in Komodo

此生再无相见时 提交于 2019-11-30 09:07:20
问题 I am having trouble using openpyxl scripts in Komodo edit 9 and python 3.4 on Windows 7. I copied some openpyxl code to learn, but it won't execute from Komodo. I receive a permission error 13. I checked my path and python34 is present. The same script will run when I use IDLE or Command Prompt. My Komodo command is currently: %(python3) -u %F Any ideas on what may be causing this issue? The code and error are included below from openpyxl import Workbook from openpyxl.compat import range from

How to detect exceptions in concurrent.futures in Python3?

时间秒杀一切 提交于 2019-11-30 08:28:43
问题 I have just moved on to python3 as a result of its concurrent futures module. I was wondering if I could get it to detect errors. I want to use concurrent futures to parallel program, if there are more efficient modules please let me know. I do not like multiprocessing as it is too complicated and not much documentation is out. It would be great however if someone could write a Hello World without classes only functions using multiprocessing to parallel compute so that it is easy to

Reload a Module in Python 3.4 [duplicate]

人走茶凉 提交于 2019-11-30 08:15:43
This question already has an answer here: Python3 - reload() can not be called on __import__ object? 1 answer I know this might sound like a really stupid question but whatever. I've made a small script in Python and I've made some changes while in a shell. Normally, on an OS X computer (It's running Python 2.7), I would simply type in reload(the_module) and it would reload my module that includes the changes that I have made. However, when I am reloading the module here (on windows python v. 3.4), it simply gives me this: >>> reload(instfile) Traceback (most recent call last): File "<pyshell

Compiling Python 3.4 is not copying pip

无人久伴 提交于 2019-11-30 07:56:20
I have compiled Python 3.4 from the sources on Linux Mint, but for some reason it is not copying pip to its final compiled folder (after the make install ). Any ideas? Rui Lima Just sorted it out. Here it is how to compile python from the sources. $ ./configure --prefix=/home/user/sources/compiled/python3.4_dev --with-ensurepip=install $ make $ make install If you get "Ignoring ensurepip failure: pip 1.5.4 requires SSL/TLS" error: $ sudo apt-get install libssl-dev openssl $ ls 2to3 idle3 pip3.5 python3 python3.5m pyvenv 2to3-3.5 idle3.5 pydoc3 python3.5 python3.5m-config pyvenv-3.5 easy

Python ftplib: Show FTP upload progress

☆樱花仙子☆ 提交于 2019-11-30 07:23:31
I am uploading a large file with FTP using Python 3.4. I would like to be able to show the progress percentage while uploading the file. Here's my code: from ftplib import FTP import os.path # Init sizeWritten = 0 totalSize = os.path.getsize('test.zip') print('Total file size : ' + str(round(totalSize / 1024 / 1024 ,1)) + ' Mb') # Define a handle to print the percentage uploaded def handle(block): sizeWritten += 1024 # this line fail because sizeWritten is not initialized. percentComplete = sizeWritten / totalSize print(str(percentComplete) + " percent complete") # Open FTP connection ftp =

Should I use two asyncio event loops in one program?

丶灬走出姿态 提交于 2019-11-30 06:53:57
I want use the Python 3 asyncio module to create a server application. I use a main event loop to listen to the network, and when new data is received it will do some compute and send the result to the client. Does 'do some compute' need a new event loop? or can it use the main event loop? dano You can do the compute work in the main event loop, but the whole event loop will be blocked while that happens - no other requests can be served, and anything else you have running in the event loop will be blocked. If this isn't acceptable, you probably want to run the compute work in a separate