Hello,
I am very, very new at this, new at programming in general actually. This is probably a very simple question, but I need to start somewhere.
I am trying to use a python script as part of the HEC-DSSVue software package to write and extract from the DSS database. I need to read in a csv file to then write to the database.
The HEC-DSSVue software includes a simple python script editor. If my understanding is correct, I need to import the csv module. I am using:
This yields a ImportError: no module named csv.
Other script imports have been:
I am just guessing that I need to set something up in the CMD file, but I am not sure what it should be. Any help would be very much appreciated.
Thanks.
1 1750 bvdet 2,851
Expert Mod 2GB
Hello,
I am very, very new at this, new at programming in general actually. This is probably a very simple question, but I need to start somewhere.
I am trying to use a python script as part of the HEC-DSSVue software package to write and extract from the DSS database. I need to read in a csv file to then write to the database.
The HEC-DSSVue software includes a simple python script editor. If my understanding is correct, I need to import the csv module. I am using:
This yields a ImportError: no module named csv.
Other script imports have been:
I am just guessing that I need to set something up in the CMD file, but I am not sure what it should be. Any help would be very much appreciated.
Thanks.
Have you installed Python on your system? Does the file csv.py exist on your system. Check your path: - import sys
-
for p in sys.path:
-
print p
If the file exists in one of these subdirectories and the subdirectory has an __init__.py file, it should import.
If the CSV file is simple, you may be able to write your own. E.G. this simple file: 1 01,02,05,07,18
2 00,01,04
3 09,20,21
4 12,34,56,77,88,99
5 03,05,77,88,54 The following code will create a dictionary from which you can write to your database: - def file_data1(f):
-
dd = {}
-
for line in f:
-
lineList = line.split()
-
dd[int(lineList[0])] = [int(i) for i in lineList[1].split(',')]
-
return dd
-
-
dd = file_data1(open('csv.txt').readlines())
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Kevin MacKenzie |
last post by:
I'm a complete newbie to using Python. I have a small question about
importing modules.
Is there any difference between the two following statements, and what
(if any) are they?
>>> from...
|
by: Stian Søiland |
last post by:
all examples performed with:
Python 2.3+ (#2, Aug 10 2003, 11:09:33)
on linux2
(2, 3, 0, 'final', 1)
This is a recursive import:
|
by: Raaijmakers, Vincent \(GE Infrastructure\) |
last post by:
Question:
my src path looks like this:
src\root\sub1
src\root\sub2
My main code is in root, lets say main.py and there is also a lib.py.
In sub1 there if foo1.py and sub2 foo2.py
Sorry for...
|
by: Doug Baroter |
last post by:
Hi,
One of my clients has the following situation. They use Access DB for
data update etc. some business functions while they also want to view
the Access data quickly and more efficiently in...
|
by: jet |
last post by:
Hi,
Maybe this is an easy task, but I'm having a really hard time figuring
out how to do this. I'm a complete newbie to SQL Server.
I have a database dump file from MySQL that's in .sql...
|
by: Charles Fineman |
last post by:
I've been asked to look over an integration toolkit that has a bunch
of schemas to specify message format. There are a couple of strange
things I noticed right off the bat and I wanted to get...
|
by: Dan |
last post by:
Could someone please help me with auto importing a series of data
files into an Access table. I tried to follow code given below in a
previous messagebut i'm getting error messages.
Here's my...
|
by: Bruce W. Roeser |
last post by:
All,
I'm reading a book by Charles Petzold (Programming VS.Net). Pretty good
content but am confused about the difference. From the text:
...
|
by: SMALLp |
last post by:
Hy!
I'm new in Linux, and i feel little less newer in python.
I need advice and help. I'm making an application witch purpose is
irrelevant. It has a lot of code for now and I've only made...
|
by: 123bargains |
last post by:
Hello, I have a question on importing a database from MSSQL 2000 to MSSQL 2005. I hope someone on here can help me answer it.
I am trying to import a database from MSSQL 2000 to 2005. But, when I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |